accept string and find out how many times the is occurred, c program to find the occurrence of a character in a string,c program to find the occurrence of a word in a string,program to find occurrence of a character in a string in java,c program to count number of characters in a string,c program to find the occurrence of a character in a string in c,c program to find frequency of characters in a string,c program to search a character in a string,c program to count number of characters in a string using pointers
#include"stdio.h"
#include"conio.h"
#include"string.h"
void main()
{
char ch[50];
int i,word=0;
clrscr();
printf("\nEnter the string=");
gets(ch);
for(i=0;ch[i]!='\0';i++)
{
if(i==strlen(ch)-3)
{
if(((ch[i]=='t')||(ch[i]=='T'))&&ch[i+1]=='h'&&ch[i+2]=='e')
{
word+=1;
}
}
else
{
if(((ch[i]=='t')||(ch[i]=='T'))&&ch[i+1]=='h'&&ch[i+2]=='e'&&ch[i+3]==' ')
{
word+=1;
i=i+3;
}
}
}
printf("\n\n\"The\" word occured %d times.",word);
getch();
}