Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, i = 0;
- cin >> n;
- while (n != 1)
- {
- i ++;
- if ((n % 2) != 0)
- {
- n = n * 3 + 1;
- continue;
- }
- else
- {
- n = n / 2;
- continue;
- }
- }
- cout << i;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement