avukas

najslovo

Jan 25th, 2014
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. char najslovo(char *s)
  4. {
  5. int i, brojac[30];
  6. for (i=0; i<30; i++)
  7. brojac[i]=0;
  8.  
  9. while(*s!=0)
  10. {
  11. if (*s>='A' && *s<='Z')
  12. brojac[*s-'A']++;
  13. if (*s>='a' && *s<='z')
  14. brojac[*s-'a']++;
  15. int maxi=0; int maxv=0;
  16. for (i=0; i<30; i++)
  17. {
  18. if (brojac[i]>maxv)
  19. {
  20. maxv=brojac[i];
  21. maxi=i;
  22. }
  23. }
  24.  
  25. }
  26. return brojac;
  27.  
  28. }
  29.  
  30.  
  31. int main()
  32. {
  33. char n[30],m,i ;
  34. printf("Unesite neku rijec:\n");
  35. scanf("%s", &n[i]);
  36. char slovo=najslovo(&n);
  37. printf("Najslovo je: %s \n",slovo );
  38.  
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment