Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 8th, 2020 119 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Sum(a: string) : integer;
  2. begin  
  3.   var len := Length(a);
  4.   Result := 0;
  5.   for var i := 1 to len do    
  6.   begin
  7.     var err := 0;
  8.     var v := 0;
  9.     val(a[i], v, err);
  10.    
  11.     if (err <> 0) then
  12.     begin    
  13.       writeln('Ошибка = ', a[i]);
  14.       exit();
  15.     end;        
  16.    
  17.     writeln(Result.ToString(), ' + ', a[i], ' = ', Result + v);
  18.     Result := Result + v;
  19.   end;
  20. end;
  21.  
  22. var
  23.   b: string;
  24. begin
  25.   readln(b);  
  26.   var r := Sum(b);
  27.   writeln(r);
  28.   while (Length(r.ToString()) > 1) do
  29.   begin
  30.     r := Sum(r.ToString());    
  31.     writeln(r);
  32.   end;  
  33. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top