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 / jyoti
#include<stdio.h>
#include<conio.h
#include<string.h>
void main()
{
char st[200],nw[20];
int i,j=0;
clrscr();
printf("enter string");
gets(st);
printf("enter new string");
gets(nw);
for(i=0;st[i]!='\0';i++)
{if (strcmp(nw,st)==0)
j=j++;
}}
getch();
}
| Is This Answer Correct ? | 68 Yes | 183 No |
Post New Answer View All Answers
Implement bit Array in C.
Explain how can you determine the size of an allocated portion of memory?
write a c program to do the following: a) To find the area of a triangle. b) To convert the temperature from Fahrenheit to Celsius. c) To convert the time in hours : minutes : seconds to seconds.
What is the use of ?: Operator?
Multiply an Integer Number by 2 Without Using Multiplication Operator
Mention four important string handling functions in c languages .
What do header files do?
How can I change the size of the dynamically allocated array?
Where define directive used?
Is null always defined as 0(zero)?
What is the heap in c?
Is fortran faster than c?
What does the c in ctime mean?
What is static identifier?
What is typeof in c?