#include<stdio.h> #include<string.h> int main() { int a,n,sum[1000]={0}; scanf("%d%d",&a,&n); int k=n,j=0; while(n--){ for(int i=n;i<k;i++){ sum[j]+=a; } j++; } for(int l=j-1;l>0;l--){ if(sum[l]>=10){ int temp=sum[l]; int tempp=sum[l]; int t=l; sum[t]=temp%10; sum[t-1]+=tempp/10; } } for(int l=0;l<j;l++) printf("%d", sum[l]); printf("\n"); return 0; } |
Double click to view unformatted code.