Computer Science, asked by ritukumari18972, 5 hours ago

Write a program to input a number and check whether it is positive or negative and display appropriate message.

Answers

Answered by samarthkrv
0

Answer:

import java.util.*;

class evenOdd

{

public static void main(String args[])  

 {

 Scanner scanner = new Scanner(System.in);

 int num;

 System.out.println("Enter a number");

 num  = scanner.nextInt();

  if(num%2==0)

   {

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

   }

  else

   {

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

   }

 }

}

Explanation:

Similar questions