Computer Science, asked by bruhzinga, 10 months ago

write a program in JAVA to enter a number and check if it is positive, negative or 0

Answers

Answered by sehajpalamit
1

Answer:

Read a number from the user using the Scanner class's method. check whether the given number is greater, lesser or, equal to 0. If it is greater given number is positive if the lesser given number is negative. the else given number is neither positive or negative.

please mark me as brainliest

Answered by Anonymous
1

Answer:

Java Program to Check if a Given Integer is Positive or Negative

public class Postive_Negative.

  • int n;
  • Scanner s = new Scanner(System.
  • System. out. print("Enter the number you want to check:");
  • n = s. nextInt();
  • if(n > 0)
  • System. out. println("The given number "+n+" is Positive");
  • else if(n < 0)
Similar questions