#include <iostream>
using namespace std;


void pb1(){
    int b = 99;
    b = b * 2 + 9 ;
    b = b * 2 + 9 ;
    b = b * 2 + 9 ;
    b = b * 2 + 9 ;
    b = b * 2 + 9 ;
    cout<<b;
}
void pb2(){
    int money=350000;
    int age=15;
    if (money > 500000) {
      if (age >= 19) {
        cout << "부유한 어른";
      } 
      else {
        cout<<"부유한 학생";
      }
    } 
    else if (money > 100000) {
      if (age >= 19) {
        cout<<"평범한 어른";
      } 
      else {
        cout<<"평범한 청소년";
      }
    } 
    else {
      cout<<"가난함";
    }
}
void pb3(){
    int d = 0;
    for(int i = 1; i<=10000; i = i+1){
        d = d+i;
    }
    cout << d;
    
}

void pb4(){
    int r = 0;
    for(int i = 1; i<=500; i = i+1){
        r = r+i*i;
    }
    cout << r;
    
}

void pb5(){
    int t = 0;
    for(int i = 0; i<=10000; i = i+1){
        t = t+i;
    }
    cout << t;
    
}

void pb6(){
    int t = 0;
    for(int i = 1; i<=9999; i = i+1){
    
        t = t + i % 10;
    }
    cout << t;
    
}

void pb7(){
    int t = 1;
    int h = 1;
    int g = 0;
    for(int i = 1; i<=10; i = i+2){
    
        t = t*i;
    }
    for(int i = 2; i<=10; i = i+2){
    
        h = h *i;
    }
    if (h>=t) {
        g = h-t;
    } else {
        g = t-h;
    }
    cout << g;
    
}

void colatz(){
    int n = 54;
    int cnt = 0;
    while(1){
        cout << n<<"->";
        cnt++;
        if(n==1){
            break;
        }
        if(n%2==1){
            n=n*3 +1;
        }
        else{
            n=n/2;
            
        }
    }
    cout <<"\n 수열의 길이:"<<cnt<<"\n";
    cout<<"콜라츠 수열 종료\n";


    
}



int main() {
    pb1();
    //pb2();
    //pb3();
    //pb4();
    //pb5();
    //pb6();
    //pb7();
    colatz();
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: