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
Multiply an Integer Number by 2 Without Using Multiplication Operator
Explain the process of converting a Tree into a Binary Tree.
What is meant by type specifiers?
Is c++ based on c?
What are the difference between a free-standing and a hosted environment?
How does placing some code lines between the comment symbol help in debugging the code?
Explain how do you sort filenames in a directory?
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
What are the advantages of c language?
Tell me about low level programming languages.
Why static variable is used in c?
Explain what is the most efficient way to store flag values?
What are external variables in c?
What does s c mean on snapchat?
What is the difference between array and linked list in c?