Program:-
import java.util.Scanner;
public class problem1
{
public static void main(String[] args)
{
int a;
Scanner s = new Scanner(System.in);
System.out.print("Enter the any number :");
a = s.nextInt();
if(a % 2 == 0)
{
System.out.println(""+a+" is Even ");
}
else
{
System.out.println(""+a+" is Odd ");
}
}
}
Output:-
import java.util.Scanner;
public class problem1
{
public static void main(String[] args)
{
int a;
Scanner s = new Scanner(System.in);
System.out.print("Enter the any number :");
a = s.nextInt();
if(a % 2 == 0)
{
System.out.println(""+a+" is Even ");
}
else
{
System.out.println(""+a+" is Odd ");
}
}
}
No comments:
Post a Comment