Welcome to my blog this is test

28 June 2012

write a C program which will READ A TEXT and COUT ALL OCCURANCES OF A PARTICULAR WORD


//Code:
#include
#include
#include
 void main()
  {
   char ch[50];
   int i,j,l;
   clrscr();
   printf("\n Enter any string : ");
   gets(ch);
   l=strlen(ch);
   j=0;
    for(i=0;i
     if(ch[i]==' ')
     j++;
    printf("\n The no of words : %d",j+1);
   getch();
  }
/*Output:
Enter any string : my name is mostu mahalat
The no of words : 5

No comments:

Post a Comment