Computer Science, asked by nandinichaudhary1912, 1 day ago

Write a program in Java to accept 1 number from the user and find out whether it is even or odd. Display appropriate message on the screen.

Answers

Answered by ry6635440
2

import java.util.*;

public class odd_even

{

   public static void main(String args[])

   {

       Scanner scr = new Scanner(System.in);

       int a;

       System.out.println("Enter a number to check odd even");

       a = scr.nextInt();

       if(a%2==0)

           System.out.println(a + " is even number");

       else

           System.out.println(a + " is odd number");

   }

}

Similar questions