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 |
FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above
. Explain the differences between fork() and exec() in C
Explain about the constants which help in debugging?
Process by which one bit pattern in to another by bit wise operation is?
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
What is ponter?
for(;;) printf("C language") What is out put of above??
2 Answers Practical Viva Questions,
Which header file is used for clrscr?
how to write a data 10 in address location 0x2000
wat is the difference between a definition and declaration? float y;---it looks like a declaration..but it s a definition.how?someone explain
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?
What is the difference between c and python?