Advertisement
donplehanov

task1conversionprogramming

May 24th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. long long n;
  6. scanf("%lld", &n);
  7. while (true)
  8. {
  9. printf("%lld ", n);
  10. if (n==1) break;
  11. if (n%2==0) n/=2;
  12. else n = n*3+1;
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement