Advertisement
everblut

Mayor de 'n' Numeros

Mar 8th, 2011
1,440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Mayor{
  4.    
  5.     public static void main(String[] args){
  6.  
  7.     int mayor = 0;
  8.     int num = 0;
  9.     int op = 0;
  10.     Scanner objeto = new Scanner(System.in);
  11.    
  12.     System.out.print("\tEste Programa imprime el mayor de una lista de numeros \n");
  13.     do{
  14.          
  15.  
  16.     System.out.print("\n\tTeclea el numero: ");
  17.      num = objeto.nextInt();
  18.  
  19.     if(num>mayor){
  20.         mayor = num;
  21.     }
  22.     System.out.print("\n\tQuieres Seguir Ingresando Numeros?\n\t 1.-si\t2.-no ");
  23.      op = objeto.nextInt();
  24.     } while ( op == 1);
  25.    
  26.     System.out.print("\n\tEl numero mayor fue "+mayor+"\n");
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement