Untitled
raw download clone
TEXT
views 25
,
size 291 b
#include <iostream>
using namespace std;

int main()
{
    int n , cnt=1;

    cin >> n;

    while(n!=1)
    {
        if(n%2==0)
            n=n/2;
        else
            n=3*n+1;
        cnt++;
        //cout << n << " ";
    }

    cout << cnt;


    return 0;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.