progs/while-tests/collatz.while
author Christian Urban <christian.urban@kcl.ac.uk>
Mon, 10 Oct 2022 12:42:06 +0100
changeset 884 183bfb52d26e
parent 804 387240957c3d
permissions -rw-r--r--
fixed bug

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"