equal
deleted
inserted
replaced
1 // Find all factors of a given input number - J.R. Cordy August 2005 |
1 // Find all factors of a given input number |
2 var n; |
2 // by J.R. Cordy August 2005 |
|
3 |
3 write "Input n please"; |
4 write "Input n please"; |
4 read n; |
5 read n; |
5 write "The factors of n are"; |
6 write "The factors of n are"; |
6 var f; |
|
7 f := 2; |
7 f := 2; |
8 while n != 1 do |
8 while n != 1 do { |
9 while (n / f) * f = n do |
9 while (n / f) * f == n do { |
10 write f; |
10 write f; |
11 n := n / f; |
11 n := n / f |
12 end |
12 }; |
13 f := f + 1; |
13 f := f + 1 |
14 end |
14 } |