Solution:
#include <stdio.h>
#include <string.h>
// Driver code
int main()
{ char str[50]= "CodingActivity";
char c ;
int res = 0;
printf("\n enter character ");
scanf("%c",&c);
for (int i=0;i<strlen(str);i++)
// checking character in string
if (str[i] == c)
res++;
printf("occurence of %c=%d",c,res++);
return 0;
}
0 Comments