Computer Science, asked by rexina2418, 2 months ago

write a program to check entered number is positive,negative,or Zero

Answers

Answered by kamalrajatjoshi94
0

Answer:

Program:-

import java.util.*;

public class Number

{

public static void main(String args[ ])

{

Scanner in=new Scanner(System.in);

int n;

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

n=in.nextInt();

if(n>0)

{

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

}

else if(n<0)

{

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

}

else if(n==0) //Note the bolded statement is optional

{

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

}

}

}

Similar questions