/* * Autor: Juan Antonio Ripoll * Date: 30/10/13 * * Write a JAVA program to get a number from the and * answer whether it is positive or negative. * */ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter a number: "); int number = in.nextInt(); if (number>0) System.out.println(number + " is positive."); if (number<0) System.out.println(number + " is negative."); } }
Wednesday, October 30, 2013
2.01 - Positive and negative
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment