#include<stdio.h>
int main () {
int n = 0;
int sum = 0;
if(scanf("%d",&n)){};//这里是因为pta的scanf会报错
for(int i = 1;i<=n;i++)
{
sum += pow(2,i);
}
printf("result = %d",sum);
return 0;
}
最后
以上就是甜美云朵最近收集整理的关于PTA c语言 7-1 求幂之和的全部内容,更多相关PTA内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复