Write a program in Java to accept 1 number from the user and find out whether it is even or odd. Display appropriate message on the screen.
Answers
Answered by
2
import java.util.*;
public class odd_even
{
public static void main(String args[])
{
Scanner scr = new Scanner(System.in);
int a;
System.out.println("Enter a number to check odd even");
a = scr.nextInt();
if(a%2==0)
System.out.println(a + " is even number");
else
System.out.println(a + " is odd number");
}
}
Similar questions
Hindi,
12 hours ago
Math,
12 hours ago
Computer Science,
1 day ago
Science,
8 months ago
Math,
8 months ago
India Languages,
8 months ago