Sunday 16 August 2015

WAP in java to check whether the entered no is even or odd.

//Check no is even or odd

import java.util.Scanner;

class Even_Odd {

public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter a no:");
int n=sc.nextInt();

if(n%2==0)
System.out.println("Even no");
else
System.out.println("Odd no");
}

}

No comments:

Post a Comment