diff -r d59bcff69998 -r b5b1bc0a603b solution/cw2/factors.while --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/solution/cw2/factors.while Wed Dec 15 19:00:01 2021 +0000 @@ -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\n"; +f := 2; +while n != 1 do { + while (n / f) * f == n do { + write f; write "\n"; + n := n / f + }; + f := f + 1 +} \ No newline at end of file