Menu



Java program for checking even or odd number


even-odd-check.java

import java.util.Scanner;
class OddOrEven
{
public static void main(String args[])
{
int no;
System.out.println("Enter an integer to check if it is odd or even ");
Scanner sc = new Scanner(System.in);
no = sc.nextInt();
if ( no % 2 == 0 )
System.out.println("You entered an even number.");
else
System.out.println("You entered an odd number.");
}
}

Output

odd or even









Connection failed: SQLSTATE[28000] [1045] Access denied for user 'studentdb'@'localhost' (using password: YES)

Subscribe