Write a program that takes a string from user and prints the total number of vowels i.e. (a,e,i,o,u) present in the string.

#include<stdio.h>
#include<conio.h>
    void main()
    {
        char a[21];
        int j,i;
        clrscr();
        printf("\n ************************************************\n");
        printf("\n Please Give The STRING OF A : ");
        scanf("%s",a);
        flushall();

        for(i=0,j=0;a[i]!='\0';i++)
        {
            if(a[i]=='a'|| a[i]=='A')
            j++;
            if(a[i]=='e'|| a[i]=='E')
            j++;
            if(a[i]=='i'|| a[i]=='I')
            j++;
            if(a[i]=='o'|| a[i]=='O')
            j++;
            if(a[i]=='u'|| a[i]=='U')
            j++;
        }
 
        printf("\n TOTAL NO. OF VOVELS ARE %d.",j); 
        getch();
}
Outeput:
Please Give The STRING OF A : Hello Hii
TOTAL NO. OF VOVELS ARE 4.

Post a Comment

0 Comments