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 / abhishek

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

Is This Answer Correct ?    14 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to reverse a string.

1071


Explain what is dynamic data structure?

1160


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

3580


What is an operator?

1068


What is the use of a semicolon (;) at the end of every program statement?

1494


How can I read and write comma-delimited text?

1068


`write a program to display the recomended action depends on a color of trafic light using nested if statments

2124


What are the restrictions of a modulus operator?

1119


List the difference between a 'copy constructor' and a 'assignment operator' in C?

1087


why do some people write if(0 == x) instead of if(x == 0)?

1068


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

1202


What is boolean in c?

1088


What is const and volatile in c?

1044


can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......

1870


a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none

1265