program pravougaonik2;
uses crt,graph;
var  x,y,driver,mode:integer;
procedure rast(x,y:integer);
  begin
    repeat
      setcolor(white);
      rectangle(0,0,x,y);
      delay(10);
      setcolor(getbkcolor);
      rectangle(0,0,x,y);
      y:=y+1;
    until y=GetMaxY;
    setcolor(white);
    rectangle(0,0,x,y)
  end;
begin
  ClrScr;
  writeln(' Program simulira rast pravougaonika po sirini');
  writeln;
  write(' Unesi koordinate temena u intervalima (0,1023) za x i (0,886) za y:  ');
  readln(x,y);
  if (x>0) and (y>0) and (x<1023) and (y<866)
    then
    begin
      driver:=detect;
      initgraph(driver,mode,'');
      setbkcolor(black);
      setcolor(white);
      rectangle(0,0,x,y);
      rast(x,y);
      readln;
      closegraph
    end
    else
    begin
      write(' Nisi unio velicine u odgovarajuci interval!');
      readln
    end
end.