Java Program to Check Whether a Given Number is Even or Odd

Published: 25 October 2022
on channel: IT Jobs Alerts
345
6

Code :
import java.util.Scanner;
public class Odd_Even
{
public static void main(String[] args)
{
int n;
Scanner s = new Scanner(System.in);
System.out.print("Enter the number you want to check:");
n = s.nextInt();
if(n % 2 == 0)
{
System.out.println("The given number "+n+" is Even ");
}
else
{
System.out.println("The given number "+n+" is Odd ");
}
}
}


Watch video Java Program to Check Whether a Given Number is Even or Odd online without registration, duration hours minute second in high quality. This video was added by user IT Jobs Alerts 25 October 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 345 once and liked it 6 people.