updated
authorChristian Urban <urbanc@in.tum.de>
Wed, 16 Oct 2019 11:06:32 +0100
changeset 658 a18e3c027c1f
parent 657 732cb155d806
child 659 15b69ca63b29
updated
progs/factors.while
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/progs/factors.while	Wed Oct 16 11:06:32 2019 +0100
@@ -0,0 +1,14 @@
+// Find all factors of a given input number - J.R. Cordy August 2005
+var n;
+write "Input n please";
+read n;
+write "The factors of n are";
+var f;
+f := 2;
+while n != 1 do
+    while (n / f) * f = n do
+        write f;
+        n := n / f;
+    end
+    f := f + 1;
+end
\ No newline at end of file