fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int tokuten[101] = {0};
  6. int i;
  7.  
  8. while (1) {
  9. scanf("%d", &i);
  10. if (i == 999) break;
  11. if (i < 0 || 100 < i) continue;
  12. tokuten[i]++;
  13. }
  14. printf("得点 回数\n");
  15. for (i = 0; i < 101; i++) {
  16. if (tokuten[i]) {
  17. printf("%3d %d\n", i, tokuten[i]);
  18. }
  19. }
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0.01s 1724KB
stdin
10
100
50
60
10
50
10
999
stdout
得点 回数
 10  3
 50  2
 60  1
100  1