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
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 |
i want to make a program in which we use input having four digits(4321) and get output its reciprocal(1234).
how does the C compiler interpret the following two statements p=p+x; q=q+y; a. p=p+x; q=q+y b. p=p+xq=q+y c. p=p+xq; q=q+y d. p=p+x/q=q+y
What is a ternary operator in c?
Do you know what are bitwise shift operators in c programming?
Display names and numbers of employees who have 5 years or more experience and salary less than Rs.15000 using array of structures (name, number, experience and salary)
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
Implement a function that returns the 5th element from the end in a singly linked list of integers in one pass.
How reliable are floating-point comparisons?
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above
hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...
Please write the area of a RIGHT ANGLED TRIANGLE.