Untitled
// Write a Java program to get a number from the user and print whether it is positive or negative. import java.util.*; public class Question_1{ public static void main (String args []){ Scanner sc = new Scanner (System.in); System.out.println("Whether positive or negative "); int num = sc.nextInt(); if (num >= 1){ System.out.println("This is positive "); }else if (num == 0){ System.out.println("Neither positive nor negative "); }else if (num <= 0) { System.out.println("This is negitive "); } } }
Leave a Comment