#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { int a,n,i,j; scanf("%d %d",&a,&n); int sum=0; for(i=1;i<=n;i++){ j=i; while(j){ sum=sum+a*pow(10,--j); } } printf("%d",sum); } |
Double click to view unformatted code.