program pravougaonik;
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);
      x:=x+1;
    until x=GetMaxX;
    setcolor(white);
    rectangle(0,0,x,y)
  end;
begin
  ClrScr;
  writeln(' Program simulira rast pravougaonika po duzini');
  writeln;
  write(' Unesi koordinate temena (x,y) u intervalu [0,1023] za (x) i [0,886] za (y) : ');
  readln(x,y);
  if (x>0) and (y>0) and (x<1023) and (y<886)
    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(' Unesene koordinate ne odgovaraju!');
      readln
    end
end.