#include<stdio.h>#include<math.h>int main(){ int b=0,n, sum = 0,i; scanf("%d",&n); for (i = 1; i <= n; i++) { b = pow(2, i); sum += b; } printf("result = %d",sum); return 0;}
for求幂之和
原文:https://www.cnblogs.com/Totoro13/p/14070283.html