Skip to content

Instantly share code, notes, and snippets.

@IsaacGonzalez
Created October 22, 2013 21:38
Show Gist options
  • Save IsaacGonzalez/7108638 to your computer and use it in GitHub Desktop.
Save IsaacGonzalez/7108638 to your computer and use it in GitHub Desktop.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;
public class JavaApplication1 {
public static void main(String[] args) {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
try {
System.out.println("Inserte el primer numero:");
int num1 = Integer.parseInt(br.readLine());
System.out.println("Inserte el segundo numero:");
int num2 = Integer.parseInt(br.readLine());
if(num2 > num1){
int numeroAuxiliar = num1;
num1 = num2;
num2 = numeroAuxiliar;
}
System.out.println("Numero 1: " + num1);
System.out.println("Numero 2: " + num2);
} catch (IOException ex) {
Logger.getLogger(JavaApplication1.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment