Ver Mensaje Individual
  #3  
Antiguo 12-02-2012
Avatar de newtron
[newtron] newtron is offline
Membrillo Premium
 
Registrado: abr 2007
Ubicación: Motril, Granada
Posts: 3.474
Reputación: 21
newtron Va camino a la fama
Ummmmmmm.... ¿esto tiene trampa?

Si lo he entendido bien el código sería este:

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
n: SmallInt;
m: Currency;
begin
  for N:=1 to 100 do begin
    if (N mod 3= 0) and (N mod 5=0) then begin
      ListBox1.Items.Add('FizzBuzz');
    end else if (N mod 3= 0) then begin
      ListBox1.Items.Add('Fizz');
    end else if (N mod 5= 0) then begin
      ListBox1.Items.Add('Buzz');
    end else begin
      ListBox1.Items.Add(IntToStr(N));
    end;
  end;
end;

el resultado sería este:



y el tiempo ha sido dos minutillos y pico. ¿Es mucho?
__________________
Be water my friend.

Última edición por newtron fecha: 12-02-2012 a las 09:48:30. Razón: Le había puesto a todas las lineas el número delante y he visto después que no era así exactamente
Responder Con Cita