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
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
What is the collection of communication lines and routers called?
What are bitwise shift operators in c programming?
Which header file is essential for using strcmp function?
What is the advantage of c?
When should we use pointers in a c program?
When should you not use a type cast?
How can I find out if there are characters available for reading?
What is sizeof int in c?
What do you mean by command line argument?
What is n in c?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
what is bit rate & baud rate? plz give wave forms
Can we declare variables anywhere in c?