Advertisement
Guest User

numero medio

a guest
Feb 24th, 2010
1,566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. /*
  2.     belial9826
  3.     aplicacion para juangonza.wordpress.com
  4.  */
  5.  
  6. package numeroMedio;
  7.  
  8. public class numeroMedio {
  9.  
  10.     public static void main(String[] args) {
  11.  
  12.         int n1, n2, n3;
  13.  
  14.         System.out.println("Este programa dice cual es el numero medio de tres numeros");
  15.  
  16.         System.out.print("Digite el primer numero: ");
  17.         n1=Leer.datoInt();
  18.         System.out.print("\nDigite el segundo numero: ");
  19.         n2=Leer.datoInt();
  20.         System.out.print("\nDigite el tercer numero:  ");
  21.         n3=Leer.datoInt();
  22.  
  23.         if(((n2<n1)&&(n3>n1))||((n2>n1)&&(n3<n1)))
  24.             System.out.println("El numero medio es el primer numero: "+n1);
  25.         else if (((n1<n2)&&(n3>n2))||((n1>n2)&&(n3<n2)))
  26.                 System.out.println("El numero medio es el segundo numero: "+n2);
  27.         else
  28.             System.out.println("\nEl numero medio es tercer numero: "+n3);
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement