Wednesday, October 30, 2013

1.10 - Equivalent operations

/*
 * Autor: Juan Antonio Ripoll
 * Date: 30/10/13
 * 
 * Write a JAVA program to ask the user for his age 
 * (20, for instance) and answer something as "You look younger than 20" 
 * (instead of 20, you should display the age that has been entered). 
 * */

import java.util.Scanner;

public class Main {

 public static void main(String[] args) {
  Scanner in = new Scanner(System.in);
  
  System.out.print("Enter a age: ");
  int age = in.nextInt();
  
  System.out.println("You look younger than " + age + ".");
 }
}

No comments:

Post a Comment