changeset 833 | aad5957eb7e4 |
child 853 | 568671822d52 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cwtests/cw02/factors.while Sat Sep 04 14:08:00 2021 +0100 @@ -0,0 +1,11 @@ +// Find all factors of a given input number + + +write "Input n please"; +read n; +write "The factors of n are"; +f := 2; +while (f < n / 2 + 1) do { + if ((n / f) * f == n) then { write(f) } else { skip }; + f := f + 1 +} \ No newline at end of file