Even or Odd

 public class Main
{
public static void main(String[] args) {
int num = 19;
if(num%2==0)
    System.out.println("The number is even.");
else
    System.out.println("The number is odd.");
}
}
Output: The number is odd.
====================
*import from user

import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Please enter any integer number: ");
int num = scan.nextInt();
if(num%2==0)
    System.out.println("The number is even.");
else
    System.out.println("The number is odd.");
}
}

একটি মন্তব্য পোস্ট করুন