Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
19
Task/Arithmetic-Integer/Delphi/arithmetic-integer.pas
Normal file
19
Task/Arithmetic-Integer/Delphi/arithmetic-integer.pas
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
program IntegerArithmetic;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses SysUtils, Math;
|
||||
|
||||
var
|
||||
a, b: Integer;
|
||||
begin
|
||||
a := StrToInt(ParamStr(1));
|
||||
b := StrToInt(ParamStr(2));
|
||||
|
||||
WriteLn(Format('%d + %d = %d', [a, b, a + b]));
|
||||
WriteLn(Format('%d - %d = %d', [a, b, a - b]));
|
||||
WriteLn(Format('%d * %d = %d', [a, b, a * b]));
|
||||
WriteLn(Format('%d / %d = %d', [a, b, a div b])); // rounds towards 0
|
||||
WriteLn(Format('%d %% %d = %d', [a, b, a mod b])); // matches sign of the first operand
|
||||
WriteLn(Format('%d ^ %d = %d', [a, b, Trunc(Power(a, b))]));
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue