Code :
import java.util.Scanner;
class OddEven {
public static void main(String args[])
{
int number,result;
Scanner object = new Scanner(System.in);
System.out.println("Enter a number: ");
number = object.nextInt();
if (number%2==0)
{
System.out.println("You Have Entered Even Number");
}
else
{
System.out.println("You Have Entered Odd Number");
}
}
}
Output :
Enter a number:
7
You Have Entered Odd Number
IDE Used To Test This Code : Dr Java
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.
import java.util.Scanner;
class OddEven {
public static void main(String args[])
{
int number,result;
Scanner object = new Scanner(System.in);
System.out.println("Enter a number: ");
number = object.nextInt();
if (number%2==0)
{
System.out.println("You Have Entered Even Number");
}
else
{
System.out.println("You Have Entered Odd Number");
}
}
}
Output :
Enter a number:
7
You Have Entered Odd Number
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.
Post a Comment