Write a program in java to check whether a number is positive or negative integer.
import java.util.Scanner;
class intcheck
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
int n;
System.out.println("Enter the Integer:");
n= sc.nextInt();
if(n!=0)
{
if(n>0)
System.out.println(" Positive Integer ");
else
System.out.println("Negative Integer");
}
else
{
System.out.println("Number is Zero");
}
}
}
class intcheck
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
int n;
System.out.println("Enter the Integer:");
n= sc.nextInt();
if(n!=0)
{
if(n>0)
System.out.println(" Positive Integer ");
else
System.out.println("Negative Integer");
}
else
{
System.out.println("Number is Zero");
}
}
}
Post a Comment