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 |
WHAT IS MAXIMUM SIZE OF AN ARRAY IN C LANGUAGE?
8 Answers Carphone Warehouse, IBM, SAS,
How to implement call back functions ?
Program to find the value of e raised to power x using while loop
write a program to search for an element in a given array. If the array was found then display its position otherwise display appropriate message in c language
4)What would be the output? main() { int num=425; pf("%d",pf("%d",num)); } a)Comp error b)4425 c)4253 d)3435 e)none
WHAT IS ABSTRACT DATA TYPE
What ios diff. Between %e & %f?
what is the difference between static variable and register variable?
Can a program have two main functions?
Given a string write a program to print all alphabetical characters in the order of their occurance first,followed by the sum of the numeric characters then followed by the special characters in the order of their occurance.
1 Answers College School Exams Tests, Wipro,
What is external and internal variables What is dynamic memory allocation what is storage classes in C
How to implement variable argument functions ?