C program to find vowels in a String - C program to count the number of vowels



 c program to count the number of vowels

Learn C - C tutorial - c program to count the number of vowels - C examples - C programs

C program to count the number of vowels

  • Vowels are a, e, i, o, u. Vowels vary in quality, in loudness and also in quantity (length).
  • Vowels are the principal sounds of syllables.
  • Letters that are not vowels and consonants.
  • For example, in the string "C programming" there are three vowels 'o', 'a' and 'i'.

Sample Code

#include <stdio.h>
int main()
{
    char line[150]="wikitechy.com 2018";
    int i, vowels, consonants, digits, spaces;
    vowels = 0;
    printf("Line of string:wikitechy.com 2018");
    for(i=0; line[i]!='\0'; ++i)
    {
        if(line[i]=='a' || line[i]=='e' || line[i]=='i'||
                line[i]=='o' || line[i]=='u' || line[i]=='A' ||
                line[i]=='E' || line[i]=='I' || line[i]=='O' ||
                line[i]=='U')
        {
            ++vowels;
        }
    }
    printf("\nVowels: %d",vowels);
    return 0;
}

Output

Line of string:wikitechy.com 2018
Vowels: 4


View More Quick Examples


Related Searches to C program to find vowels in a String - C program to count the number of vowels