Advertisement
Nanoic

Untitled

Dec 3rd, 2023
981
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     std::cout << "Hello World!\n";
  7.     int n = 0;
  8.  
  9.     cout << n << endl;
  10.  
  11.     while (n < 100){      
  12.        
  13.         n++;
  14.  
  15.         if (n / 2 == 0) {
  16.             n = 3 * n + 1;
  17.             cout << n  << endl;
  18.         }
  19.         else if (n / 2 == 1) {
  20.            
  21.             cout << n  << endl;
  22.             n++;
  23.            
  24.         }
  25.     }
  26.  
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement