write a program to input an integer and check whether it is positive, negative or zero ( use nested if ) it's very urgent plz don't spam
Answers
Answered by
2
Answer:
import java. io. *
class number
{
public static void main (String args[])
{
int n;
Scanner s=new Scanner(System. in) ;
System.out.println ("Enter the number:") ;
n=s. nextInt() ;
if(n>0)
{
System.out.println ("Entered number is positive") ;
}
if (n<0)
{
System.out.println ("Entered number is negative") ;
}
if(n==0)
{
System.out.println ("Entered number is zero") ;
else
{
System.out.println("Enter valid number") ;
}
}
}
Similar questions