Ver Mensaje Individual
  #8  
Antiguo 16-03-2011
Avatar de gatosoft
[gatosoft] gatosoft is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Bogotá, Colombia
Posts: 835
Reputación: 24
gatosoft Va camino a la fama
Yo diria que:

Código Delphi [-]
Var n, i: Integer;
     contador, suma : Integer;
Begin
 n:= StrToInt(Edit1.text);
 contador :=0;
 suma:=0;
 For i:= 1 to n do
 begin 
    if (i mod 2 = 0) and ( not (i mod 10 = 0) ) then
      begin
        Memo1.lines.add(IntTostr(i));
        inc(contador);
        suma.= suma + i;
      end;//if
end;//for i

Memo1.lines.add('El Promedio es: '+FloattoStr(Suma/contador));


bueno la condicion puede ser como te plasca (o te resulte mas legible), siempre y cuando el resultado sea el mismo

Código Delphi [-]
   
 if (i mod 2 = 0) and ( not (i mod 10 = 0) ) then

Ó

    if (i mod 2 = 0) then 
       if (i mod 10 <> 0) ) then

saludos,
Responder Con Cita