Nackey

if-else

Jul 12th, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. package com.company;
  2.  
  3. import com.sun.org.apache.xpath.internal.SourceTree;
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class trainingCodes{
  8.     public static void main(String[] args) {
  9.         Scanner scanner = new Scanner(System.in);
  10.  
  11.         int number = Integer.parseInt(scanner.next());
  12.         if (number > 0) {
  13.  
  14.             System.out.println("The number is positive.");
  15.         }else {
  16.             if(number ==0) {
  17.                 System.out.println("The number is 0");
  18.             }else{
  19.                 System.out.println("the number is negative");
  20.             }
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment