progs/collatz.while
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 18 Oct 2016 20:39:54 +0100
changeset 456 2fddf8ab744f
parent 147 4725bba8ef26
permissions -rw-r--r--
updated

write "Input a number ";
read n;
while n > 1 do {
  if n % 2 == 0 
  then n := n/2 
  else n := 3*n+1;
};
write "Yes";