How to write a C Program to count number of sentences words and letters in a paragraph in C Programming Language ?
This C Program to count number of sentences words and letters in a paragraph.Solution:
- #include<stdio.h>
- main()
- {
- char ch[150];
- int i,c=0,c1=0,c2=0;
- printf("Enter a Paragraph \n");
- gets(ch);
- for(i=0;ch[i]!='\0';i++)
- {
- if(ch[i]=='.'||ch[i]=='!'||ch[i]=='?')
- { c++;
- c1++;
- }
- else if(ch[i]==' '||ch[i]==',')
- c1++;
- else if(ch[i]>65&&ch[i]<123)
- c2++;
- }
- printf("\nNumber of letters = %d \nNumber of words=%d ",c2,c1);
- printf("\nNumber of Sentences = %d\n",c);
- }
Learn More :
Number
- Find out the perfect number using c program
- Write a c program to find out H.C.F. of two numbers.
- Check the given number is armstrong number or not using c program.
- Write a c program to find largest among three numbers using conditional operator
- FIND OUT GENERIC ROOT OF A NUMBER - C PROGRAM.
- FIND PRIME FACTORS OF A NUMBER USING C PROGRAM
- How To Write a C program that generates two random numbers ?
- Write a C program to find maximum or equal between two numbers ?
- How to Write a C program to find maximum between two numbers ?
- Write a C program to perform math operations on two input whole numbers. The operations are:
- Write a C program to find maximum between three numbers ?
- Sort Three Numbers - program reads in three Integers and displays them in ascending order.
- C Program to Enter an ODD number between 1 and 49.
- C program acquires keyboard 10 numbers for each of these numbers to determine if it is a first issue, by printing immediately message should at the end, if none of the numbers you entered was a first issue, print an appropriate message.
- C program generates a random number and uses an algorithm to generate 9 other numbers.
- C Program to Find Random Number
- C Program To Find LCM and HCF Of Two Number Using Function - 2
- C Program to find LCM and HCF Of Two Number Using Recursion - 3
- C Program To Find LCM and HCF Of Two Number -1
- C Program To Find Reverse Of Any Digit Number
- C Program To Find The Frequency Of A Number
- C Program To Print Prime Numbers Upto The Number You Want
- C Program To Print Sum Of n Digit Number
- C Program To Reverse A Number
- C Program To Search A Number Inside The Array
Count
- C Program String - Alphabet Count Example
- C Program String Count Example
- Write the procedure , which is one of a sum , a product and a geometric average in the panel for the NxM elements are located on opposite diagonal and main diagonal . Remind ! Counting only odd elements !
- C Program Array NxM Elements Geometric/Arithmetic
- C Program to Count Number of Lines in Input until Interrupted by CTRL + Z
- Returns: array of decoded values. [0] - count of values
- Max count of chars, Max count of nums and Max count of signs
- C Program to Count Vowels, Consonants and Spaces in a string
- Un-sortiertes Array and Sortiertes Array
- C Program to Count Change Program
- LED ON OFF For One Sec/Count and Display on the Attached Serial Monitor
- Menu driven program in C which performs the following operations on strings
- C program to accept n number from user,store these numbers into an array & count the no of occurrences of each number
Letter