Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Arithmetic-Integer/Delphi/arithmetic-integer.delphi
Normal file
19
Task/Arithmetic-Integer/Delphi/arithmetic-integer.delphi
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