progs/collatz.while
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 12 Jan 2016 02:18:58 +0000
changeset 395 e57d3d92b856
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";