write a program to check if the given number is even or odd using scannet class in java
Answers
Answered by
1
Answer:
Java Program to Check if a Given Integer is Odd or Even
1. public class Odd_Even
2. int n;
3. scanner s = new Scanner(System.
4. System. out. print("Enter the number you want to check:");
5. n = s. nextInt();
6. if(n % 2 == 0)
7. System. out. println("The given number "+n+" is Even ");
8. System. out. println("The given number "+n+" is Odd ");
I HOPE THIS ANSWER WILL
HELP YOU
Similar questions