pgm to find number of words starting with capital letters
in a file(additional memory usage not allowed)(if a word
starting with capital also next letter in word is capital
cann't be counted twice)
Answers were Sorted based on User's Feedback
Answer / vadivelt
I havent write the code to read the no of words starts with
capital letter for a file. But for normal sentence given as
input.
#include<stdio.h>
#include<conio.h>
int main()
{
char *ptr;
int count = 0;
ptr = (char *)malloc(200);
printf("ENTER THE SENTENCE\n");
ptr = gets(ptr);
while(*ptr != '\0')
{
/*This condition is used for the first word
in the sentence*/
if(count == 0 && (*ptr >=65 && *ptr <= 90))
{
count++;
}
else if(*(ptr-1) == ' ' && (*ptr >=65 &&
*ptr <= 90))
{
count++;
}
ptr++;
}
printf("\nNO OF WORDS STARTS WITH CAPITAL LETTER
IS: %d\n", count);
getch();
}
| Is This Answer Correct ? | 7 Yes | 1 No |
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
Can u please send me the exam pattern and also Previous papers to javed123go@gmail.com
Explain b+ tree?
design and implement a program that reads floating-points numbers in a sentinel-controlled loop until the user terminates the program by entering zero.your program should determinate and print the smallest,largest and average of the supplied numbers.
what is object oriental programing?
#define f(x) main() { printf("\n%d",f(2+2)); }
how many key words availabel in c a) 28 b) 31 c) 32
what is the diference between pointer to the function and function to the pointer?
What is the best style for code layout in c?
What is the purpose of main() function?
what is the syallabus of computer science students in group- 1?
What is the main difference between calloc () and malloc ()?