Program in C to find total number of consonants in a string

Write a program in C to find total number of consonants in a string

#include<stdio.h>
#include<conio.h>
#include<string.h>

void main()
{
            int c=0,i,l,p;
            char a[10];
            clrscr();
            printf("program that gives total number of consonants in a string");
            printf("\n\n\n\t\t------------INPUT-------------");
            printf("\n\nenter any string");//taking input from the user
            scanf("%s",&a);
            l=strlen(a);
            for(i=0;i
            {
                        if(a[i]=='a' || a[i]=='e' || a[i]=='o' || a[i]=='i' || a[i]=='u')
                                    c++;
            }
            p=l-c;
            printf("\n\n\n\t\t------------OUTPUT------------");
            printf("\n\nthe total no. of consonants in the string are=%d",p);//printing output
            getch();
}


Post a Comment