Tuesday, 7 February 2017

JAVA PROGRAM TO FIND EVEN OR ODD NUMBER ENTERED FROM KEYBOARD BY THE USER

/* JAVA PROGRAM TO FIND EVEN OR ODD NUMBER
    ENTERED FROM KEYBOARD BY THE USER*/


import java.io.*;
class IfelseDemo2{
public static void main(String[] ar)
throws IOException{
BufferedReader br= new BufferedReader(
new InputStreamReader(System.in));
System.out.println("enter your number:");
String str= br.readLine();
int n= Integer.parseInt(str);
if(n%2==0){
System.out.println("the number "+n+" is even numer");
}
else{
System.out.println("the number "+n+" is odd numer");
}
}
}

No comments:

Post a Comment