updated draft
authorChristian Urban <urbanc@in.tum.de>
Wed, 16 Oct 2019 11:06:32 +0100
changeset 658 e215f5a6912e
parent 657 065a119cc511
child 659 fe1f9c2e3c5b
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