Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses
- SysUtils;
- var
- s, s1: string;
- function pls(s, s1: string): string;
- var
- i, len, c: integer;
- f: string;
- begin
- if (length(s) > length(s1)) then len := length(s)
- else len := length(s1);
- c := 0;
- for i := length(s) to len do s := '0' + s;
- for i := length(s1) to len do s1 := '0' + s1;
- for i := len + 1 downto 1 do
- begin
- c := strtoint(s[i]) + strtoint(s1[i]) + c;
- f := inttostr(c mod 10) + f;
- c := c div 10;
- end;
- while (f[1] = '0') do delete(f, 1, 1);
- pls := f;
- end;
- begin
- readln(s);
- readln(s1);
- writeln(pls(s, s1));
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement