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 ”)
Answers were Sorted based on User's Feedback
Answer / ankur
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char str[40],ch;
int num;
cout<<"Entre a string :";
cin.getline(str,40);
cout<<"Entre a character :";
cin>>ch;
for(int i=0;i!='\0';++i)
{
if(str[i]==ch)
num=num+1;
}
cout<<num;
getch();
}
| Is This Answer Correct ? | 20 Yes | 74 No |
Answer / 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 |
plz answer..... a program that reads non-negative integer and computes and prints its factorial
Write a program to check armstrong number in c?
#include<stdio.h> int f(int,int); int main() { printf("%d",f(20,1)); return 0; } int f(int n,int k) { if(n==0) return 0; else if(n%2)return f(n/2,2*k)+k; else return f(n/2,2*k)-k; } how this program is working and generating output as 9....?
If you know then define #pragma?
do you think its fraud or original company?
What is I ++ in c programming?
Write a program to check prime number in c programming?
main() { int i=400,j=300; printf("%d..%d"); }
Is the following code legal? struct a { int x; struct a b; }
wat is the difference between a definition and declaration? float y;---it looks like a declaration..but it s a definition.how?someone explain
program to get the remainder and quotant of given two numbers with out using % and / operators?
10 Answers College School Exams Tests, IBM,
What are disadvantages of C language.