progs/collatz.while
author Christian Urban <christian.urban@kcl.ac.uk>
Thu, 16 Apr 2020 19:15:46 +0100
changeset 721 e3c64f22dd31
parent 147 4725bba8ef26
permissions -rw-r--r--
added slides from Rochester

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