You are viewing a single comment's thread. Return to all comments →
UPVOTE IF FOUND HELPFUL
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { char *s; char c; int *array = (int *)calloc(10, sizeof(int)); s = malloc(50 * sizeof(char)); scanf("%s",s); int len=strlen(s); for(int i=0;i<10;i++) { for(int j=0;j<len;j++) { c = i + '0'; { if(s[j]==c) array[i]++; } } for (int i = 0; i < 10; i++) { printf("%d ", array[i]); } return 0; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Digit Frequency
You are viewing a single comment's thread. Return to all comments →
UPVOTE IF FOUND HELPFUL