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