Pages

Subscribe:

Count Number Of Vowels And Consonants In A String

This  C program  to count number of  vowels and consonants in an entered string. Here variables " v  mean  vowel " is increment whenever is a vowel found in tracing otherwise " c mean consonant " is increment .



Program :


#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
do{
char s[100];
int i,v=0,c=0;
clrscr();
    printf("\n Enter a string :");
    gets(s);
    for(i=0;s[i]!=NULL;i++)
    {
        if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||
        s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U')

        {
            v++;
        }
        else
        {
            if(s[i]!=' '||s[i]!='.')
                c++;
        }
    }
    printf("\n The total number of vowel is[%d]  and consonants is [%d] ",v,c);
    printf("\n Continue (y/n):");
    ch=getch();
}while(ch=='y'||ch=='Y');

}

Output :






If you have any Further Information and Quires about this Article don't hesitate to comment in comment box below.
                                                           AND

 If you like this article , like our Facebook like page and click  +1 to support 123techguide
comments powered by Disqus
 

Listed In

Bloggers - Meet Millions of Bloggers http://Link-exchange.comxa.com
Blog Search: The Source for Blogs Internet Blogs

Disclaimer

The contents in this blog are taken from various sources available over the internet, therefore we do not gurantee of it's accuracy, if you find any of the content in the blog is infringing it's copyright, please do email us on '123techguide@gmail.com' and we will make sure to remove the same from the blog at the earliest.