jackyhuichunkit

IF-Statement Example 1

Oct 9th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class iftest01 {
  4.  
  5.     public static void main(String[] args) {
  6.         int age;
  7.         Scanner sc = new Scanner(System.in);
  8.  
  9.         System.out.print("How old are you?");
  10.         age = sc.nextInt();
  11.         if (age > 13) {
  12.             System.out.println("Adult ticket please.");
  13.         } else {
  14.          System.out.println("Children ticket please.");
  15.         }
  16.     }
  17.  
  18. }
Add Comment
Please, Sign In to add comment