write a program to count numbers of vowels or consonants in a string
Answers
Answered by
0
Answer:
int main() {
char s[1000]; int i,vowels=0,consonants=0;
printf("Enter the string : "); gets(s);
for(i=0;s[i];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')
vowels++; else. ...
} }
printf("vowels = %d\n",vowels);
Explanation:
int main() {
char s[1000]; int i,vowels=0,consonants=0;
printf("Enter the string : "); gets(s);
for(i=0;s[i];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')
vowels++; else. ...
} }
printf("vowels = %d\n",vowels);
Similar questions