Código (cpp) [Seleccionar]
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "Ingrese numero : ";
cin>>n;
do
{
cout << n << '-';
if(n % 2 == 0)
n = n/2;
else {
n=(3*n+1);
cout << n << '-';
n /= 2;
}
} while(n != 1);
return EXIT_SUCCESS;
}