Given a sentence of words, count the number of vowels for the sentence which may contain both lowercase and uppercase alphabets.
#include <stdio.h>
#include<string.h>
#include<stdlib.h>
int main(void) {
char *s;
int vowels=0,consonants=0;
s=(char*)malloc(sizeof(char));
gets(s);
while(*s)
{
if(*s>='A' && *s<='Z')
{
if(*s=='A' || *s=='E' || *s=='I' || *s=='O' || *s=='U')
vowels++;
else
consonants++;
}
else if(*s>='a' && *s<='z')
{
if(*s=='a' || *s=='e' || *s=='i' || *s=='o' || *s=='u')
vowels++;
else
consonants++;
}
s++;
}
printf("vowels = %d\n",vowels);
printf("consonants = %d",consonants);
return 0;
}