Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- int najcifra (char *s) {
- int j;
- int br_cifara[10];
- for (j=0; j<10; j++) br_cifara[j]=0;
- while (*s!='\0') {
- if (*s>='0' && *s<='9')
- br_cifara[*s-'0']++;
- s++;
- }
- int max_br=0, i, maxi;
- for (i=0; i<10; i++) {
- if (br_cifara[i]>max_br) {
- max_br=br_cifara[i];
- maxi=i;
- }}
- return maxi;
- }
- int main () {
- char s[]="34df421";
- printf("%d",najcifra(s));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement