Wednesday 18 January 2017

WAP to find whether a given number is even or odd

import java.util.*;
class oddandeven{
public static void main(String []args){
int a;
Scanner inp=new Scanner(System.in);

System.out.println("Enter number");
a=inp.nextInt();


if(a%2==0)
System.out.println("even");
else
System.out.println("odd");

}
}

No comments:

Post a Comment