# HG changeset patch # User Christian Urban # Date 1571220392 -3600 # Node ID a18e3c027c1f254746df1a3a2eac9682297c8d3e # Parent 732cb155d806642ecaf788d4b2aa089798a52d61 updated diff -r 732cb155d806 -r a18e3c027c1f 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