SlepoiKrot

Untitled

Feb 20th, 2018
92
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program NUMBER1;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. uses
  6.   SysUtils, Math;
  7. var
  8.   s1, s2: string;
  9.   i, asize, bsize, per, j : integer;
  10.   a, b, sum: array [1..10001] of integer;
  11. begin
  12.   readln (s1, s2);
  13.   asize := 10001;
  14.   bsize := 10001;
  15.   for i := length (s1) downto 1 do begin
  16.     dec (asize);
  17.     a[asize] := ord(s1[i]) - 48;
  18.   end;
  19.   for i := length (s2) downto 1 do begin
  20.     dec (bsize);
  21.     b[bsize] := ord(s2[i]) - 48;
  22.   end;
  23.   per := 0;
  24.   for i := 10000 downto 1 do begin
  25.     per := (per + a[i] + b[i]) div 10;
  26.     sum [i] := (per + a[i] + b[i]) mod 10;
  27.   end;
  28.   j := 1;
  29.   while (sum[j] = 0) do begin
  30.     inc (j);
  31.   end;
  32.   for i := j to 10000 do begin
  33.     write(sum[i]);
  34.   end;
  35.    
  36.   readln;
  37.   readln;
  38. end.
RAW Paste Data