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