Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- int age;
- String name;
- System.out.print( "Hello. What is your name?" );
- name = keyboard.next();
- System.out.print( "Hi " + name + "! How old are you?" );
- age = keyboard.nextInt();
- System.out.print( "Did you know that in five years you will be " + (age+5) + " years old?" );
- System.out.println ("\nAnd five years ago you were " + (age-5) + "! Imagine that!" );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement