Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- int i, j, t;
- char sentence[10000];
- char x;
- scanf("%d", &t);
- for(i = 1; i <= t; i++)
- {
- int n = 0;
- gets(sentence);
- scanf("%c", &x);
- int len = strlen(sentence);
- for(j = 0; j < len; j++)
- {
- if (sentence[j] == x)
- {
- n++;
- }
- }
- if(n==0)
- printf("'%c' is not present\n", x);
- else
- printf("Occurrence of '%c' in '%s' = %d\n", x, sentence, n);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement