8.odd and even number using if else.
import java.util.*;
class oddeven
{
public static void main(String arg[])
{
Scanner obj = new Scanner(System.in);
int no;
System.out.print("Enter any no. : ");
no = obj.nextInt();
if(no % 2 == 0)
System.out.println(no + " is Even number");
else
System.out.println(no + " is Odd number");
}
}
Comments
Post a Comment