martes, 21 de abril de 2015
e_18
package ejercicio18;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class EJERCICIO18 {
public static void main(String[] args) throws IOException {
// TODO code application logic here
int n1,n2,n3,mayor,inter,menor;
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Numero 1: ");
n1= Integer.parseInt(in.readLine());//ojo
System.out.println("Numero 2: ");
n2=Integer.parseInt(in.readLine());//ojo
System.out.println("Numero 3: ");
n3= Integer.parseInt(in.readLine());//ojo
if(n1 > n2 && n1 > n3)
{
mayor=n1;
}
else
{
if (n2 > n1 && n2> n3)
{
mayor=n2;
}
else
{
mayor=n3;
}
}
if(n1 < n2 && n1 < n3)
{
menor=n1;
}
else
{
if (n2 < n1 && n2 < n3)
{
menor=n2;
}
else
{
menor=n3;
}
}
inter=(n1 + n2 + n3)- (mayor + menor);
System.out.println("");
System.out.println("Mayor:" + mayor);
System.out.println("Inter:" + inter);
System.out.println("Menor:" + menor);
System.out.println();
}
}
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario