WAP in java to find whether the user given number is even or odd.
Answers
Answered by
1
import java.util.*;
public class Evenorodd
{
public static void main()
{
Scanner in=new Scanner (System.in);
int n;
System.out.println("Enter the number");
n=in.nextInt(); //Taking the number input from the user
if(n%2==0)
System.out.println("Even number");
else
System.out.println("Negative number");
}
}
Attachments:
Similar questions