Advertisement
Josif_tepe

Untitled

Jan 16th, 2024
654
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.90 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <string.h>
  4. void funkcija(char * niza, char * podniza) {
  5.     int brojac = 0;
  6.     for(int i = 0; i < strlen(niza); i++) {
  7.         if(niza[i] == podniza[0]) {
  8.             int ok = 1;
  9.             for(int j = 0; j < strlen(podniza); j++) {
  10.                 printf("%c ", niza[i + j]);
  11.             }
  12.             printf("\n");
  13.             for(int j = 0; j < strlen(podniza); j++) {
  14.                 printf("%c ", podniza[j]);
  15.             }
  16.             printf("\n");
  17.             if(ok == 1) {
  18.                 brojac++;
  19.             }
  20.         }
  21.     }
  22.     printf("%d\n", brojac);
  23. }
  24. int main(int argc, const char * argv[]) {
  25.     char niza[1000];
  26.     char podniza[1000];
  27.    
  28.     fgets(niza, 500, stdin);
  29.     fgets(podniza, 500, stdin);
  30.  
  31.     printf("%s\n", podniza);
  32.     funkcija(niza, podniza);
  33.     return 0;
  34. }
  35.  
  36.  
  37. /*
  38. Ovoj tekst e proben tekst
  39. tekst
  40. */
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement