Advertisement
EWTD

Prime numbers

Apr 1st, 2017
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.34 KB | None | 0 0
  1. program lcl;
  2.  
  3. var
  4.   i, m, n, j: integer;
  5.   a: array[1..100] of integer;
  6.  
  7. begin
  8.   readln(n);
  9.   i := 2;
  10.   m := 1;
  11.   repeat
  12.     if (n mod i) = 0 then
  13.     begin;
  14.       n := n div i;
  15.       a[m] := i;
  16.       m := m + 1;
  17.     end
  18.     else
  19.       i := i + 1;
  20.   until n = 1;
  21.   for j := 1 to m do
  22.   begin;
  23.     writeln(a[j]);
  24.   end;
  25. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement