UNA HERMOSA MOTO

UNA HERMOSA MOTO

miércoles, 22 de abril de 2015

Problema Resuelto 16



16.- DADO 03 NÚMEROS ENTEROS DEVOLVER EL NÚMERO MAYOR.




/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package problema016;
import java.io.*;
/**
 *
 * @author ABEL MONTALVAN
 */
public class PROBLEMA016 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException{

 int n1,n2,n3,m;
 BufferedReader in=new BufferedReader(new  InputStreamReader(System.in));
 System.out.println("Número 1: ");
 n1= Integer.parseInt(in.readLine());
 System.out.println("Número 2: ");
 n2=Integer.parseInt(in.readLine());
 System.out.println("Número 3: ");
 n3= Integer.parseInt(in.readLine());
 if (n1>n2)
 {
     if(n1>n3)
     {
       m=n1;
     }
     else
     {
       m=n3;
     }
 }
 else
 {
     if(n2>n3)
     {
       m=n2;
     }
     else
     {
       m=n3;
     }
 }
 System.out.println("");
 System.out.println("Mayor: " +m);

    }
}        
        

No hay comentarios:

Publicar un comentario