Computer Science, asked by Ankita0406, 7 months ago

Write a program in java to accept a positive number from user. Check and display whether it is
even number or odd number.

Please don't text anything except the answer.

This question is not for gaining free points.

This is a request.



Answers

Answered by Anonymous
8

Answer:

Java Program to Check if a Given Integer is Odd or Even

  • public class Odd_Even.
  • int n;
  • Scanner s = new Scanner(System.
  • System. out. print("Enter the number you want to check:");
  • n = s. nextInt();
  • if(n % 2 == 0)
  • System. out. println("The given number "+n+" is Even ");
  • System. out. println("The given number "+n+" is Odd ");

Explanation:

Similar questions