Advertisement
everblut

Mayor de 'n' Numeros

Mar 8th, 2011
765
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. using System;
  2.  
  3. public class Mayor 
  4. {
  5.     public static void Main(string[] args)
  6.     {
  7.         int mayor = 1;
  8.         int num = 0;
  9.         int op = 0;
  10.         int cont = 1;
  11.         Console.WriteLine("Este programa imprime el mayor de los numeros ingresados \n");
  12.        
  13.         do{
  14.             Console.WriteLine("Teclea el {0} numero: ",cont);
  15.             num = Convert.ToInt32(Console.ReadLine());
  16.            
  17.               if(num>mayor)
  18.               {
  19.                mayor = num;
  20.               }
  21.             Console.WriteLine("Quieres seguir ingresando numeros? ");
  22.             Console.WriteLine("1.- Si   2.- No  ");
  23.             op = Convert.ToInt32(Console.ReadLine());
  24.             cont++;
  25.         }while (op == 1);
  26.        
  27.         Console.WriteLine("El numero mayor fue {0}",mayor);
  28.        
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement