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...


Input is "Jack and jill went up a hill"
To print output is 1-letter word(s)-1
2-letter words-1
3-letter words-1
4-letter words-4



Input is "Jack and jill went up a hill" To print output is 1-letter word(s)-1 2-letter w..

Answer / bin

#include <stdlib.h>
#include <stdio.h>

int words[8];

int wordcount(char *string) {
int i;

for (i=0; *string; ++string) {
if (*string != ' ' && *string != '\t') {
++i;
} else {
words[i] += 1;
i = 0;
}
}
if (i) words[i] += 1;
}

int main()
{
int i;
char *str = "Jack and jill went up a hill";
wordcount(str);
for (i = 1; i < 5; ++i) {
printf("%d-letter word is - %d\n", i, words[i]);
}

}

Is This Answer Correct ?    42 Yes 7 No

Post New Answer

More C Interview Questions

FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above

0 Answers  


. Explain the differences between fork() and exec() in C

2 Answers  


Explain about the constants which help in debugging?

0 Answers  


Process by which one bit pattern in to another by bit wise operation is?

0 Answers   InterGraph,


Write an algorithm for a program that receives an integer as input and outputs the product of of its digits. E.g. 1234 = 24, 705 = 0

4 Answers  


What is ponter?

0 Answers   TCS,


for(;;) printf("C language") What is out put of above??

2 Answers   Practical Viva Questions,


Which header file is used for clrscr?

0 Answers  


how to write a data 10 in address location 0x2000

3 Answers  


wat is the difference between a definition and declaration? float y;---it looks like a declaration..but it s a definition.how?someone explain

3 Answers   TCS,


send me the code of flow chart generator using C-programming language amd this code should calculate the time and space complexity of the given progran and able to generate flowchart according to the given program?

0 Answers   TCS,


What is the difference between c and python?

0 Answers  


Categories