write a program to check whether the integer type number is taken as input positive negative or zero
Avirajchettri:
bluej
Answers
Answered by
7
check out this program:::
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
if(a<0){
System.out.println("negative number");
}
else if(a>0){
System.out.println("positive number");
}
else{
System.out.println("number you enter is zero");
}
}
}
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
if(a<0){
System.out.println("negative number");
}
else if(a>0){
System.out.println("positive number");
}
else{
System.out.println("number you enter is zero");
}
}
}
Similar questions