Ver Mensaje Individual
  #3  
Antiguo 16-08-2007
Avatar de jhonny
jhonny jhonny is offline
Jhonny Suárez
 
Registrado: may 2003
Ubicación: Colombia
Posts: 7.070
Reputación: 32
jhonny Va camino a la famajhonny Va camino a la fama
Jo jo jo, ahora ya hacemos hasta tareas

Código Delphi [-]
var
  i, Acumulado :Integer;
  UltimoDigito :String;
begin
  Acumulado := 0;
  UltimoDigito := Edit1.Text[Length(Edit1.Text)];
  for i := 1 to Length(Edit1.Text)-1 do
  begin
    Acumulado  := Acumulado + StrToInt(Edit1.Text[i]);
  end;

  if IntToStr(Acumulado)[Length(IntToStr(Acumulado))] = UltimoDigito then
    ShowMessage('Correcto')
  else
    ShowMessage('InCorrecto');
end;
__________________
Lecciones de mi Madre. Tema: modificación del comportamiento, "Pará de actuar como tu padre!"

http://www.purodelphi.com/
http://www.nosolodelphi.com/
Responder Con Cita