title: How to write numbers separated with commas in a loop on one line?
body: <p>I am making a program of prime number in FreePascal.</p>
  
  <p>How to output number divides with I1,I2 separated with commas instead of 2 lines?</p>
  
  <pre><code>var
    P:Integer;
    I:Integer;
    J:Integer;
    A:Integer;
  
    begin
  
      writeln('Prime number program');
      writeln;
      writeln('Insert number');
      readln(P);
  
      for I:=2 to P-1 do
      begin
        J:=P Mod I;
        if (J=0) then
        begin
          writeln(P,' divides with ',I);
          a:=a+1
        end;
      end;
  
      if a=0 then
        begin
        writeln(P,' is prime number')
        end;
    end.
  </code></pre>