fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int
  5. main()
  6. {
  7. char s[31], *t[] = {"小文字", "大文字", "数字"};
  8. int i, r[3] = {0, 0, 0};
  9.  
  10. printf("文字列を入力して下さい.");
  11. scanf("%s", s);
  12. i = strlen(s);
  13. while (i--) {
  14. r[0] += ('a' <= s[i]) && (s[i] <= 'z');
  15. r[1] += ('A' <= s[i]) && (s[i] <= 'Z');
  16. r[2] += ('0' <= s[i]) && (s[i] <= '9');
  17. }
  18. for (i = 0; i < 3; i++)
  19. printf("%sは%d文字,", t[i], r[i]);
  20. puts("です.\n");
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0.02s 1680KB
stdin
TanakaHanako1234
stdout
文字列を入力して下さい.小文字は10文字,大文字は2文字,数字は4文字,です.