看下还要添加什么程序
这道题要怎么改才能满足题意呢?定义函数要怎么写啊,和double有什么区别?
# include <stdio.h>
# include<math.h>
int main(void)
{
int a,n,sum,j,i,k;
printf("Enter a:");
scanf("%d",&a);
printf("Enter n:");
scanf("%d",&n);
sum=0;
for(i=1;i<=n;i++){
j=a*pow(10,n-i);
sum=sum+j;
}
printf("sum=%d\n",sum);
return 0;
}