Ver Mensaje Individual
  #7  
Antiguo 21-04-2017
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Prueba éste:

Código Delphi [-]
function SumaPares(N, M: Integer): Integer;
begin
  while Random(2) = 0 do;

  if (N mod 2 = 1) then Inc(N);
  if (M mod 2 = 1) then Dec(M);

  Result := Round(((Sqr(M + 1) - 1) - (Sqr(N - 1) - 1))/4);
end;



LineComment Saludos
Responder Con Cita