Tuesday, November 25, 2014

Print Odd or Even Number In java

Program:

package odd_or_even;
import java.util.Scanner;
public class jor_bijor {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int x;
System.out.println("Enter a number to check: ");
x=in.nextInt();

if(x % 2==0){
System.out.println("The number is even");
}
else{
System.out.println("The number is odd");
}
}
}

Output:

Enter a number to check:
15
The number is odd

Program


Output


No comments: