Advertisement
CamiloCastilla

Untitled

Sep 11th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         Scanner keyboard = new Scanner(System.in);
  8.  
  9.         int age;
  10.         String name;
  11.  
  12.  
  13.         System.out.print( "Hello. What is your name?" );
  14.         name = keyboard.next();
  15.  
  16.         System.out.print( "Hi " + name + "! How old are you?"  );
  17.         age = keyboard.nextInt();
  18.  
  19.         System.out.print( "Did you know that in five years you will be " + (age+5) + " years old?" );
  20.         System.out.println ("\nAnd five years ago you were " + (age-5) + "! Imagine that!" );
  21.  
  22.  
  23.  
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement