Advertisement
erfanul007

LA 3996

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