Follow on Facebook

Like and Share on Facebook

Tuesday, March 10, 2015

Write a Program to find Number is even or odd

import java.io.*;
public class Addition
{
public static void main(String args[])throws IOException
{
int a,b,c;
InputStreamReader ir=new InputStreamReader(System.in);
BufferedReader br= new BufferedReader(ir);
System.out.println("Enter a Number");
a=Integer.parseInt(br.readLine());
if(a%2==0)
{
System.out.println("Number is Even");
}
else{
System.out.println("Number is Odd");
}

}
}


Output:

Enter a Number
56
Number is Even

No comments:

Post a Comment