Ver Mensaje Individual
  #2  
Antiguo 03-08-2007
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Reputación: 20
cHackAll Va por buen camino
Haber si te entendí, media? Lo obvio, con un array sunmas cada valor;

Código Delphi [-]
var
 r: array[0..200] of Integer;
 n, i: Integer;
 s: Int64;
 
...
 
 s := 0;
 for i := 0 to n - 1 do
  s := s + r[i];
 WriteLn(s div n);  // Por ejemplo no se qué harás con el resultado así que un clásico WriteLn
 
...

Pero si no te interesan los valores del vector entonces haces "chanchullo"

Código Delphi [-]
 ReadLn(n);
 s := 0;
 for i := 0 to n - 1 do
  begin
   Write('Ingresa el siguiente numero: '); 
   ReadLn(r); // r := Random(666); // ???
   s := s + r;
 end;
 WriteLn(s div n);  // Label1.Caption := IntToStr(s div n); ???

Sera?

Última edición por cHackAll fecha: 03-08-2007 a las 17:37:21.
Responder Con Cita