반복문 - 반복문 활용 예제13(규칙숫자 찾기2)

2018. 7. 8. 11:18algorithm/dimigo.goorm.io

#include <stdio.h>


int main() {

int num;

int solve =3;

int wow = 3;

int i;

scanf("%d", &num);

for (i = 1; i < num; i++) {

solve = solve * 2 + 3;

wow += solve;

}

printf("%d", wow);

}