program linije9;
uses crt,graph;
var driver,mode,x,broj,i,d:integer;
begin
  ClrScr;
  writeln(' Ovaj program prikazuje vertikalne linije sa promjenom boje');
  writeln;
  write(' Unesite X-ordinatu neke tacke linije: ');
  readln(x);
  write(' Unesite broj linija: ');
  readln(broj);
  driver:=detect;
  initgraph(driver,mode,'');
  setbkcolor(black);
  d:=GetMaxX div broj;
  if (x>GetMaxX) or (x<0) or (d<1)
    then
      begin
        restorecrtmode;
        write('X mora biti u intervalu [0,',GetMaxX,'],ili broj linija mora biti manji!');
        readln
      end
    else
    begin
      for i:=0 to broj-1 do
        begin
          setcolor(i);
          Line(x+d*i,0,x+d*i,GetMaxY);
        end;
      readln;
      closegraph
    end;
end.