: Write a program to ask the user to input a number then Check Whether the input Number is Even or Odd .
Answers
Answered by
1
import java.util.Scanner;
public class EvenOdd{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
System.out.println("Enter a number:");
int n=sc.nextInt();
if(n%2==0)
System.out.println("The number is even.");
else
System.out.println("The number is odd.");
}
}
Similar questions
Computer Science,
2 months ago
Political Science,
2 months ago
Chemistry,
2 months ago
Math,
5 months ago
Math,
5 months ago
English,
11 months ago
Science,
11 months ago