write a program to check entered number is positive,negative,or Zero
Answers
Answered by
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
Math,
1 month ago
English,
2 months ago
Social Sciences,
2 months ago
Hindi,
9 months ago
Hindi,
9 months ago