История изменений
Исправление Shaman007, (текущая версия) :
В архиве:
(* program that sums integer values from A to B without loops
2020 (c) saahriktu
Under GNU GPLv3 *)
program sumatob;
uses sysutils;
var
a, b, s : Int64;
begin
if ParamCount < 2 then begin
writeln('usage: sumatob A B');
exit;
end;
if TryStrToInt64(ParamStr(1), a) = False then begin
writeln('Error: invalid number A');
exit;
end;
if TryStrToInt64(ParamStr(2), b) = False then begin
writeln('Error: invalid number B');
exit;
end;
if b < a then begin
s := a;
a := b;
b := s;
end;
s := trunc((b - a + 1) * (a + b) / 2);
writeln(s);
end.
Нда.
Исходная версия Shaman007, :
В архиве:
(* program that sums integer values from A to B without loops 2020 (c) saahriktu Under GNU GPLv3 *) program sumatob; uses sysutils; var a, b, s : Int64; begin if ParamCount < 2 then begin writeln(‘usage: sumatob A B’); exit; end; if TryStrToInt64(ParamStr(1), a) = False then begin writeln(‘Error: invalid number A’); exit; end; if TryStrToInt64(ParamStr(2), b) = False then begin writeln(‘Error: invalid number B’); exit; end; if b < a then begin s := a; a := b; b := s; end; s := trunc((b - a + 1) * (a + b) / 2); writeln(s); end.
Нда.