Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

1. Write a C program to count the number of occurrence
of
a specific word in the given strings.
(for e.g. Find how many times the word “live” comes in the
sentence “Dream as if you’ll live forever, live as if
you’ll die today ”)

Answer Posted / vikas kumar

#include<stdio.h>
#include<conio.h>
void main()
{
int i,occ=0;
char str[100],ch;
printf("\n enter string");
scanf("%s",str);
printf("\n enter character");
scanf("%s",ch);
for(i=0;i[str]!='\0';i++)
{
if(str[i]==ch)
{
occ++;
}
}
printf("\n occurance of %c in %s is %d",ch str occ);
getch();
}

Is This Answer Correct ?    25 Yes 66 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Multiply an Integer Number by 2 Without Using Multiplication Operator

724


Explain the process of converting a Tree into a Binary Tree.

2608


What is meant by type specifiers?

1082


Is c++ based on c?

1023


What are the difference between a free-standing and a hosted environment?

1220


How does placing some code lines between the comment symbol help in debugging the code?

941


Explain how do you sort filenames in a directory?

983


Can you explain what keyboard debouncing is, and where and why we us it? please give some examples

2145


What are the advantages of c language?

1042


Tell me about low level programming languages.

1067


Why static variable is used in c?

978


Explain what is the most efficient way to store flag values?

1173


What are external variables in c?

1037


What does s c mean on snapchat?

1039


What is the difference between array and linked list in c?

1083