//2.WAP to determine the number of occurrence in a string
#include
#include
int main()
{
int i,cnt=0;
char s[100],c;
printf("Enter the string :");
gets(s);
printf("Enter the occurrence :");
scanf("%c",&c);
for(i=0;s[i]!='\0';i++)
{
if(s[i]==c)
cnt++;
}
printf("The number of occurrence (%c) is found %d times.\n",c,cnt);
return 0;
}