progs/collatz.while
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Sun, 28 Sep 2014 22:30:25 +0100
changeset 262 ee4304bc6350
parent 147 4725bba8ef26
permissions -rw-r--r--
updated handouts

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";