progs/while-tests/collatz.while
changeset 742 b5b5583a3a08
parent 147 4725bba8ef26
child 804 387240957c3d
equal deleted inserted replaced
741:e66bd5c563eb 742:b5b5583a3a08
       
     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";