डाउनलोड पी.डी.एफ. ई-बुक्स
Core Java - Check Positive And Negative Number

विवरण :

कोई विवरण नहीं है |


सोर्स कोड :

import java.util.Scanner;

public class Number
{
public static void main(String args[]){ 

int num;
System.out.println("Enter a number: ");
Scanner enter = new Scanner(System.in);
num = enter.nextInt();

if (num==0)
{
System.out.println("You entered zero .");
}
else if (num>=0)
{
System.out.println("You entered positive number .");
}
else{
System.out.println("you entered negative number .");
}

}
}

आउटपुट :

Enter a number: 
-8
you entered negative number .