solutions/cw3/collatz.while
changeset 905 15973df32613
parent 894 02ef5c3abc51
equal deleted inserted replaced
904:d97283992d4f 905:15973df32613
     1 write "Input a number ";
     1 write "Input a number ";
     2 read n;
     2 read n;
     3 while n > 1 do {
     3 while n > 1 do {
     4   if n % 2 == 0 
     4   if n % 2 == 0 
     5   then n := n/2 
     5   then n := n/2 
     6   else n := 3*n+1;
     6   else n := 3*n+1
     7 };
     7 };
     8 write "Yes\n";
     8 write "Yes\n"