progs/collatz.while
changeset 147 4725bba8ef26
equal deleted inserted replaced
146:9da175d5eb63 147:4725bba8ef26
       
     1 write "Input a number ";
       
     2 read n;
       
     3 while n > 1 do {
       
     4   if n % 2 == 0 
       
     5   then n := n/2 
       
     6   else n := 3*n+1;
       
     7 };
       
     8 write "Yes";