program pravougaonici;
uses crt,graph;
var  a,b,dx,dy,lx,ly,razlika,x,y,driver,mode:integer;
     odg:char;
begin
  ClrScr;
  writeln(' Program iscrtava familije pravougaonika u mjeri koja je moguca za date parametre');
  writeln;
  write(' Unesi koordinate preseka dijagonala ');
  readln(a,b);
  write(' Unesi duzinu stranice ');
  readln(lx,ly);
  write(' Da li upisivati(u) ili opisivati(o) ');
  readln(odg);
  write(' Unesi razliku ');
  readln(razlika);
  driver:=detect;
  initgraph(driver,mode,'');
  dx:=lx div 2;
  dy:=ly div 2;
  x:=getMaxX;
  y:=GetMaxY;
  if odg='o' then razlika:=-razlika;
     while (dx>0) and (dy>0) and (dx<x) and (dy<y)
           and (a-dx>0) and (b-dy>0)do
      begin
        rectangle(a-dx,b-dy,a+dx,b+dy);
        lx:=lx-razlika;
        ly:=ly-razlika;
        dx:=lx div 2;
        dy:=ly div 2
      end;
  if odg='u' then
     begin 
        rectangle(a-dx,b-dy,a+dx,b+dy);
        lx:=lx-razlika;
        ly:=ly-razlika;
        dx:=lx div 2;
        dy:=ly div 2
      end;
   readln;
   closegraph
end.