Skip to content

Instantly share code, notes, and snippets.

@alcidesfp
Created December 20, 2013 19:41
Show Gist options
  • Save alcidesfp/8060217 to your computer and use it in GitHub Desktop.
Save alcidesfp/8060217 to your computer and use it in GitHub Desktop.
Programa mascota en Java
import java.io.*;
class nomedad {
public static void main (String[] args) throws IOException {
Integer edad;
String strnombre;
BufferedReader brin;
int n;
/* Inicialización */
brin = new BufferedReader(new
InputStreamReader(System.in));
/* Comienza rutina principal */
System.out.print("Hola, ¿Cuál es tu nombre? ");
strnombre = new String(brin.readLine());
System.out.print("¿En que año naciste? ");
edad = new Integer(brin.readLine());
n = 2006 - edad.intValue();
System.out.print("Hola, ");
System.out.println(strnombre);
System.out.print("En el año 2006 tendrás ");
System.out.print(n);
System.out.println(" años");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment