Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int VelikoSlovo (char c) {
- if (c>='A' && c<='Z') return 1;
- return 0;
- }
- int MaloSlovo (char c) {
- if (c>='a' && c<='z') return 1;
- return 0;
- }
- int length (char *s) {
- int duzina=0;
- while (*(s++)!='\0') duzina++;
- return duzina;
- }
- int Funkcija (char *s) {
- int br=0,i, duz=length(s);
- int slova[25];
- for (i=0; i<25; i++) slova[i]=0;
- for (i=0; i<duz; i++) {
- if (VelikoSlovo(s[i])) slova[s[i]-'A']++;
- else if (MaloSlovo(s[i])) slova[s[i]-'a']++;
- }
- for (i=0; i<25; i++) {
- if (slova[i]==2) br++;
- }
- return br;
- }
- int main () {
- printf("Broj slova koja se ponavljaju 2 puta u recenici: %d", Funkcija("Abeceda"));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement