progs/while-tests/collatz.while
author Christian Urban <christian.urban@kcl.ac.uk>
Sun, 15 Nov 2020 00:33:16 +0000
changeset 804 387240957c3d
parent 742 b5b5583a3a08
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"