WAP to check whether a number is even or odd using *While loop* in 'java'.
Answers
Answered by
2
Answer:
import java.util.Scanner;
class Check
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
System.out.println("Enter a number:");
int n=s.nextInt();
if(n%2==0)
System.out.println("Even");
else
System.out.println("Odd");
}
}
Similar questions
Computer Science,
5 months ago
Computer Science,
5 months ago
English,
5 months ago
Math,
10 months ago
Math,
1 year ago
History,
1 year ago