Computer Science, asked by rkansara139, 3 months ago

Write a Java program which reads a number from the user and verify whether the entered number is even or odd. ​

Answers

Answered by sanjiththesupernigha
0

Answer:

import java.util.Scanner;

public class test {

public static void main(String[] args) {

  int num;

        System.out.println("Enter an number to check for odd or even:");

        Scanner input = new Scanner(System.in);

        num = input.nextInt();

   if ( num % 2 == 0 )

       System.out.println("Entered number is even");

    else

       System.out.println("Entered number is odd");

}

}

Explanation:

Similar questions