Sha256: 577430cf2ddf78dec9d15450b64190e708429fd2403675a46dcc51203e46f3c9

Contents?: true

Size: 538 Bytes

Versions: 10

Compression:

Stored size: 538 Bytes

Contents

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.

Version data entries

10 entries across 7 versions & 1 rubygems

Version Path
zettacode-0.1.7 files.zettacode/arithmetic.integer/delphi.txt
zettacode-0.1.6 files.zettacode/arithmetic.integer/delphi.txt
zettacode-0.1.6 files.zettacode2/arithmetic.integer/delphi.txt
zettacode-0.1.5 files.zettacode/arithmetic.integer/delphi.txt
zettacode-0.1.5 files.zettacode2/arithmetic.integer/delphi.txt
zettacode-0.1.4 files.zettacode/arithmetic.integer/delphi.txt
zettacode-0.1.4 files.zettacode2/arithmetic.integer/delphi.txt
zettacode-0.1.3 files.zettacode/arithmetic.integer/delphi.txt
zettacode-0.1.2 files.zettacode/arithmetic.integer/delphi.txt
zettacode-0.1.1 zettacode.files/arithmetic.integer/delphi.txt