Saturday, October 22, 2011

solution of balagurusamy of chapter 8.4

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
int i,a=0;
char *p1,*p2,c[10],ch[30];
printf("Enter the string:\n");
p1=gets(ch);
printf("Enter the word:\n");
p2=gets(c);
i=0;
while(ch[i]!='\0')
{
if(p2==p1)
{ a+=1; }
++i;
}
printf("No. of occurance= %d",a);
getch();
}

No comments:

Post a Comment