C Program to count vowels, consonants and spaces in a string in C Programming Language ?
This C Program to Count Vowels, Consonants and Spaces in a string.
In this C Program the Sentence is Entered by the User and the C Program then Count Vowels, Consonants and Spaces in a String.
To Find:
- Total number of vowels entered.
- Total number of consonants entered.
- Total number of spaces entered.
Solution:
- #include<stdio.h>
- main()
- {
- int i,cons=0,vow=0,sp=0;
- char a[100];
- printf("Enter the sentence\n");
- gets(a);
- for(i=0;a[i]!='\0';i++)
- {
- if(a[i]=='a'||a[i]=='A')
- vow=vow+1;
- else if(a[i]=='e'||a[i]=='E')
- vow=vow+1;
- else if(a[i]=='i'||a[i]=='I')
- vow=vow+1;
- else if(a[i]=='o'||a[i]=='O')
- vow=vow+1;
- else if(a[i]=='u'||a[i]=='U')
- vow=vow+1;
- else if(a[i]==' ')
- sp=sp+1;
- else
- cons=cons+1;
- }
- printf("Total number of vowels entered = %d\n",vow);
- printf("Total number of consonants entered = %d\n",cons);
- printf("Total number of spaces entered = %d\n",sp);
- }
Learn More :
Consonant
Vowel
String
- Write a c program to check given string is palindrome number or not.
- C Program to Convert Text String to Binary
- C Program String - Alphabet Count Example
- C Program String Example
- C Program String Count Example
- C Program String Example
- C Program to Print a String Without Use Semicolon.
- C Program To Find Length Of A String Including Blank Spaces, Tabs, And Other Special Characters
- C Program To Find Length Of String And Concatenate Two Strings
- C Program To Find The Length, Reverse Of A String And To Check It Is Palindrome or Not
- C Program To Print String In Formatted Output Form
- C Program To Reverse The String Using Pointer
- C Program Concatenating Two Strings Into A Third System
- C Program Date from string DDDD-DD-DD
- BUILDS A STRING FROM THE LSB BITS OF EACH PIXEL
- C Program Finds Sub-String Search in String
- C Program to concatenate two strings without using string functions
- C Program to convert a string to upper case
- C Program Performs a search and replace for a specified target and replacement string
- C Program Anagrams
- C Program to find string length without library function
- C Program to Check Given String is Palindrome or Not
- C Program to Converts a Number to a String.
- Design a C function that shortens a string to 8 characters
Enter by User
- C Program to Enter an ODD number between 1 and 49.
- C Program to Calculation of One Number Raised to Another
- C Program to calculate Area, Perimeter of Rectangle; Area, Circumference of Circle.
- C program calculates a given function in range given by user, stores the data in arrays and displays the answer in a table.
- C Program to find result where value and power are user given
- C Program That in a Given Natural Number x Insert Figure c at Position p
- C Program To Find Prime Number And If Number Is Not Prime Then Find Factors
- C program that lets the user choose if he wants to add a item to the shopping list or print it out
- C Program that prompts the user to input a string, (whitespaces allowed)
- C Program to Input Number by the user between 1-100
- How to Gets User Input For Height in C Programming
- Loudness Program: Gets loudness level from user; chooses a response And prints it using logical and operative statements
- C Program Exchange User Entered Text Between 2 Modules
- C Program to accept n numbers from user & find out the maximum element out of them by using dynamic memory allocation
- C Program to accept string from user & convert all lower case letters into upper case letters & vice versa
- C Program to accept m*n matrix from user and display the elements of given matrix using function
- C Program to accept n numbers from user store these numbers into an array & calculate average of n numbers
- C program to accept n number from user,store these numbers into an array & count the no of occurrences of each number
- C Program to accept n numbers from user store these numbers into an array & reverse an array elements using function
- C Program to accept a string from user, delete all vowels from that string & display the result
- Write a c program to accept a string from user & generate following pattern (e.g, input "abcd")
- C Program to accept 5 names from user & store these names into an array. Sort these array elements in alphabetical order
- C Program to accept n numbers from user,store these numbers into an array & sort the number of an array
- C Program to accept n numbers from user, store these numbers into an array. Find out Maximum & Minimum number from an 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 number of sentences words and letters in a paragraph
- 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