参考代码:
#include<stdio.h> int main(void){ int i; int n,frequency; int num,sum; scanf("%d%d",&n,&frequency); sum = num = n; for(i=1;i<frequency;i++){ num = n+num*10; //计算每个数字 sum = sum+num; //对数字求和 //printf("num=%lld sum=%lld\n",num,sum); } printf("%d",sum); return 0; }
0.0分
0 人评分