fork download
  1. #include <stdio.h>
  2. /* подсчет цифр, символов-разделителей и прочих символов */
  3. main()
  4. {
  5. int c, i, nwhite, nother;
  6. int ndigit[10];
  7.  
  8. nwhite = nother = 0;
  9. for (i = 0; i< 10; ++i)
  10. ndigit[i] = 0;
  11.  
  12. while ((c = getchar()) != EOF)
  13. if (c >= '0' && c <= '9')
  14. ++ndigit[c - '0'];
  15. else if (c == ' ' || c == '\n' || c == '\t')
  16. ++nwhite;
  17. else
  18. ++nother;
  19. printf("Digity =");
  20. for (i=0; i< 10; ++i)
  21. printf(" %d", ndigit[i]);
  22. printf(", symboly-razdeliteli =%d, prochie %d\n", nwhite, nother);
  23. }
Success #stdin #stdout 0s 2164KB
stdin
proverka podsheta 12341
stdout
Digity = 0 2 1 1 1 0 0 0 0 0, symboly-razdeliteli =2, prochie 16