Skip to content

Instantly share code, notes, and snippets.

@hpetru
Created February 18, 2015 21:00
Show Gist options
  • Select an option

  • Save hpetru/fa27cde912444bd70467 to your computer and use it in GitHub Desktop.

Select an option

Save hpetru/fa27cde912444bd70467 to your computer and use it in GitHub Desktop.
Program MIN_ION;
const N = 2;
type
vec = array[1..N] of integer;
function min(a, b: vec) : integer;
var i : integer;
var _min : integer;
begin
_min := a[1];
for i := 1 to N do begin
if a[i] < _min then _min := a[i];
if b[i] < _min then _min := b[i];
end;
min := _min;
end;
var a, b : vec;
begin
a[1] := 1;
a[2] := 2;
b[1] := 3;
b[2] := 0;
writeln(min(a, b));
writeln('Ion');
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment