Thursday, April 10, 2014

Search Sub String individual

Q. Write a C program to accept two string from user, first is main string and second is searching sub string from main string, and count how many times its repeat individual in main string.
OR
Q. WAP to accept two string and find out how many times individual sub-string found in main string.


For example:


First main string: This is a good program
Second search string: is
Result: 1


Ans.


/*c program for search sub string from main string and counting how many times its repeat individual*/
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
 int i,j,count=0;
 char str[40],fstr[10];
 printf("Enter main string: ");
 gets(str);
 printf("Enter sub string: ");
 gets(fstr);
 for(i=0; str[i]!=

Related Posts by Categories

0 comments:

Post a Comment