7 שיעור 

program minmax;
const N=20;
var a:array[1..n] of integer;
    i,j:integer;
(***************************************************************************)
procedure mini;
var i:1..n;
    min:integer;
begin
  min:=a[1];
  for i:=2 to n do
    if a[i]<min then min:=a[i];
  writeln(min);
  writeln
end;
(***************************************************************************)
begin
  for i:=1 to n do
  begin
    read(a[i]);  write(a[i]:3)
  end;
  writeln;
  mini;
  for i:=1 to n do
  begin
    read(j);  a[i]:=a[i]+j;
    write(a[i]:3)
  end;
  writeln;
  mini
end.


program minmax2;
const n=20;
type list=array[1..n] of integer;
var a,b:list;
    i,min1,min2:integer;
(***************************************************************************)
procedure mini(g:list;  var min:integer);      function mini(g:list):integer;
var i:1..n;                                    var i:1..n; min:integer;
begin                                          begin
  min:=g[1];                                     min:=g[1];
  for i:=2 to n do                               for i:=2 to n do
    if g[i]<min then min:=g[i]                     if g[i]<min then min:=g[i];
end;                                             mini:=min
                                               end;
(***************************************************************************)
begin
  for i:=1 to n do
  begin
    read(a[i]);  write(a[i]:3)
  end;
  writeln;
  mini(a,min1);                                min1:=mini(a);
  writeln(min1);                               writeln(min1);
  writeln;
  for i:=1 to n do
  begin
    read(j);  a[i]:=a[i]+j;  write(a[i]:3)
  end;
  writeln;
  mini(a,min2);                                writeln(mini(a));
  writeln(min2);
  writeln;
  for i:=1 to n do
  begin
    read(b[i]);  a[i]:=a[i]+b[i]
  end;
  writeln;
  mini(a,min1);                                 min1:=mini(a);
  mini(b,min2);                                 min2:=mini(b);
  writeln(min1,min2,min1-min2)
end.

-----------------------------------------------------------------------------

program parameters;
var a,b:integer;
procedure h(x:integer;  var y:integer);
begin
  x:=x+1;  y:=y+1;
  writeln(x,y)                                          
end;
begin
  a:=0;  b:=0;
  h(a,b);
  writeln(a,b)
end.

----------------------------------------------------------------------------

program scope1;           program scope2;
var a:integer;            var a:integer;
procedure setb;           procedure seta;
var b:integer;            var a:char;
begin                     begin
  b:=2*a                    a:='c'
end;                      end;
begin                     begin
  a:=2;                     a:=3;
  setb;                     seta;
  writeln(a+b)              writeln(a)
end.                      end.

-----------------------------------------------------------------------------

program sideffect;
var a,z:integer;
function sneaky(x:integer):integer;
begin
  z:=z-x;  {side effect on z}
  sneaky:=sqr(x)
end;
begin
  z:=10;  a:=sneaky(z);  writeln(a,z);
  z:=10;  a:=sneaky(10)*sneaky(z);  writeln(a,z);
  z:=10;  a:=sneaky(z)*sneaky(10);  writelna(a,z)
end.

-----------------------------------------------------------------------------

program bisect;
const eps=1e-14;
var x,y:real;
(****************************************************************************)
function zero(function f:real; a,b:real):real;
var x,z:real;

    s:boolean;
begin
  s:=f(a)<0;
  repeat
    x:=(a+b)/2.0;
    z:=f(x);
    if (z<0) = s  then a:=x
                  else b:=x
  until abs(a-b)<eps;
  zero:=x
end;
(****************************************************************************)
begin
  read(x,y);  writeln(x,y,zero(sin,x,y));
  read(x,y);  writeln(x,y,zero(cos,x,y))
end.

------------------------------------------------------------------------------

program example;
var alpha:integer;
procedure test2(var a:integer); forward;
procedure test1(var a:integer);
begin
  a:=a-1;
  if a>0 then test2(a)
end;
procedure test2;
begin
  a:=a div 2;
  if a>0 then test1(a)
end;
begin
  alpha:=15;
  test1(alpha);
  writeln(alpha)
end.