procedure setplot; begin x2:=x; y2:=y; end; procedure plot; begin line(x2,y2,x,y); setplot; end; procedure A(i : integer);forward; procedure B(i : integer);forward; procedure C(i : integer);forward; procedure D(i : integer);forward; procedure A; begin if i>0 then begin A(i-1);x:=x+h;y:=y-h;plot; B(i-1);x:=x + 2*h;plot; D(i-1);x:=x+h;y:=y+h;plot; A(i-1) end end; procedure B; begin if i>0 then begin B(i-1);x:=x-h;y:=y-h;plot; C(i-1);y:=y - 2*h;plot; A(i-1);x:=x+h;y:=y-h;plot; B(i-1) end end; procedure C; begin if i>0 then begin C(i-1);x:=x-h;y:=y+h;plot; D(i-1);x:=x - 2*h;plot; B(i-1);x:=x-h;y:=y-h;plot; C(i-1) end end; procedure D; begin if i>0 then begin D(i-1);x:=x+h;y:=y+h;plot; A(i-1);y:=y + 2*h;plot; C(i-1);x:=x-h;y:=y+h;plot; D(i-1) end end; PROCEDURE sierpin(n :INTEGER ); begin opengraph; cleargraph; h := h0; x := 1000; y := maxint - 1; setplot; A(n);x:=x+h;y:=y-h;plot; B(n);x:=x-h;y:=y-h;plot; C(n);x:=x-h;y:=y+h;plot; D(n);x:=x+h;y:=y+h;plot end;