Search This Blog

Translate

c program to find the occurrence of the in given sentence

 c program to find the occurrence of the in given sentence ,

 c program to count the frequency of 'the'


#include
#include
void main()
{
  int cnt=0,i;
  char s1[20];
  clrscr();
  printf("\n Enter string:");
  gets(s1);
   for(i=0;s1[i]!='\0';i++)
     if(s1[i]=='t' && s1[i+1]=='h'&&s1[i+2]=='e')
      {
    cnt++;
      }

      printf("\n No times \"the\"appear:%d",cnt);

  getch();
}

C Program example List

Google+ Badge