#include<stdio.h> #include<math.h> int main() { int i,n,sum; printf("Enter n:"); scanf("%d",&n); sum=0; for(i=1;i<=n;i++){ sum=sum+pow(2,i); } printf("result=%d\n",sum); return 0; }
转载于:https://www.cnblogs.com/reaper/p/3379252.html
#include<stdio.h> #include<math.h> int main() { int i,n,sum; printf("Enter n:"); scanf("%d",&n); sum=0; for(i=1;i<=n;i++){ sum=sum+pow(2,i); } printf("result=%d\n",sum); return 0; }
转载于:https://www.cnblogs.com/reaper/p/3379252.html