C
#include <stdio.h>
int main()
{
int a=0, count=0;
scanf("%d",&a);
for(; a != 1; count++)
{
if(a%2 == 0)
a /= 2;
else a = (3*a+1)/2;
}
printf("%d",count);
return 0;
}
C++
#include <iostream>
using namespace std;
int count = 0;
void handle(int a)
{
for(;a != 1;count++)
{
if(a%2 == 0)
a /= 2;
else
a = (3*a+1)/2;
}
}
int main()
{
int n = 0;
cin >> n;
handle(n);
cout << count;
return 0;
}