diff -r e66bd5c563eb -r b5b5583a3a08 progs/while-tests/factors.while --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/progs/while-tests/factors.while Thu Jul 30 13:50:54 2020 +0100 @@ -0,0 +1,14 @@ +// Find all factors of a given input number +// by J.R. Cordy August 2005 + +write "Input n please"; +read n; +write "The factors of n are"; +f := 2; +while n != 1 do { + while (n / f) * f == n do { + write f; + n := n / f + }; + f := f + 1 +} \ No newline at end of file