Files
BasicsOfComputerSoftwareEng…/05/Optional03.c
2022-10-15 20:40:43 +08:00

17 lines
438 B
C

#include <stdio.h>
int main() {
int N = 0, count[3] = {0};
// Count[0] stores the number of occerence of 5, [1] counts for 6, [2] counts for 7
scanf("%d", &N);
while (N > 0) {
switch (N % 10) {
case 5: count[0]++; break;
case 6: count[1]++; break;
case 7: count[2]++; break;
}
N /= 10;
}
printf("%d %d %d", count[0], count[1], count[2]);
return 0;
}