Advertisement
Saleh127

Untitled

May 3rd, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int a[15],c,n,i,j,k,l,x;
  5. scanf("%d",&c);
  6. for( i=1; i<=c; i++)
  7. {
  8. for(j=0; j<=10; j++)
  9. {
  10. a[j]=0;
  11. }
  12. scanf("%d",&n);
  13. for(j=1; j<=n; j++)
  14. {
  15. l=j;
  16. while(l!=0)
  17. {
  18. k=l%10;
  19. a[k]++;
  20. l=l/10;
  21. }
  22. }
  23. for(j=0; j<10; j++)
  24. {
  25. printf("%d",a[j]);
  26. if(j<9)
  27. printf(" ");
  28. }
  29. printf("\n");
  30. }
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement