blob: 47f07aeb6c44712bb64f6373cdd590a05f1b48c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
#include<unistd.h>
void ft_print_comb(void);
int dcount[10] = {0}; // 10 ints, all initialized to 0
while(num) {
dcount[num % 10]++; // increment dcount[i], where i is the last digit of num
num /= 10; // "remove" last digit from num
}
for (int i = 0; i < sizeof(dcount)/sizeof(dcount[0]); i++)
printf("%d occured %d times\n", i, dcount[i]);
|