fork download
  1. #include <stdio.h>
  2.  
  3. int sum (int n){
  4. int i;
  5. int x=0;
  6. int y=n;
  7. int z=n;
  8. for(i=1; i<=n; i++){
  9. x = x + z;
  10. y = y*10;
  11. z = z + y;
  12. }
  13. return x;
  14. }
  15.  
  16. int main(void) {
  17. int n;
  18. scanf("%d",&n);
  19. printf("%d\n",sum(n));
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0.01s 5276KB
stdin
4
stdout
4936