write a program in java to input a number and check wether it is odd or even.
Answers
Answered by
1
Answer:
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 ");
}
}
}
Similar questions
English,
15 hours ago
Math,
15 hours ago
Math,
1 day ago
Geography,
1 day ago
Computer Science,
8 months ago
Business Studies,
8 months ago