Write a program in Java to display whether a given number is even or odd. Please enter the value in the beginning. Please help me, tomorrow is my exam.
Answers
Answered by
4
public class Beginning
{
public static void main(String [] args)
{
int a;
Scanner Demo = new Scanner(System.in);
System.out.println("Enter Number :");
a = Demo.nextInt();
if(a % 2 == 0)
{
println("The Number is even");
else
println("The Number is Odd");
}
}
Hope this helps! :)
{
public static void main(String [] args)
{
int a;
Scanner Demo = new Scanner(System.in);
System.out.println("Enter Number :");
a = Demo.nextInt();
if(a % 2 == 0)
{
println("The Number is even");
else
println("The Number is Odd");
}
}
Hope this helps! :)
RosyX:
Tumne kiya
Similar questions