fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n,count=0;
  5. n=30;
  6. while(n!=1){
  7. if(n%2==0){
  8. n=n/2;
  9. }
  10. else{
  11. n=3*n+1;
  12. }
  13. count++;
  14. }
  15.  
  16. printf("%d\n",count);
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
18