Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- char najslovo(char *s)
- {
- int i, brojac[30];
- for (i=0; i<30; i++)
- brojac[i]=0;
- while(*s!=0)
- {
- if (*s>='A' && *s<='Z')
- brojac[*s-'A']++;
- if (*s>='a' && *s<='z')
- brojac[*s-'a']++;
- int maxi=0; int maxv=0;
- for (i=0; i<30; i++)
- {
- if (brojac[i]>maxv)
- {
- maxv=brojac[i];
- maxi=i;
- }
- }
- }
- return brojac;
- }
- int main()
- {
- char n[30],m,i ;
- printf("Unesite neku rijec:\n");
- scanf("%s", &n[i]);
- char slovo=najslovo(&n);
- printf("Najslovo je: %s \n",slovo );
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment