progs/while-tests/collatz.while
author Christian Urban <christian.urban@kcl.ac.uk>
Thu, 05 Oct 2023 14:36:54 +0100
changeset 940 46eee459a999
parent 804 387240957c3d
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"