find the vowel and consanant in string

 Write a Program to find out how many vowel and consonants in string which you entered in c and c++


#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
char ch[100];
int i,total=0; clrscr();
cout<<"Enter the name\n";
cin>>ch;
for(i=0;i<strlen(ch);i++)
{
if(ch[i]=='a'||ch[i]=='A'||ch[i]=='E'||ch[i]=='e'||ch[i]=='I'||ch[i]=='i'||ch[i]=='o'||ch[i]=='O'||ch[i]=='U'||ch[i]=='u')
{
      total=total+1;
}
}
cout<<total;
getch();
}

No comments:

Post a Comment

Blogger Tips and TricksLatest 

Tips For BloggersBlogger Tricks