WAP to take 10 names,count and print how many names starts with vowels and how many starts with consonants.
Answers
Answered by
1
Answer:
I am unable to understand
Answered by
0
#include <stdio.h>
int main()
{
//Counter variable to store the count of vowels and consonant
int i, vCount = 0, cCount = 0;
char str[] = "This is a really simple sentence";
for(i = 0; i < strlen(str); i++){
str[i] = tolower(str[i]);
if(str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u') {
//Increments the vowel counter
vCount++;
}
else if(str[i] >= 'a' && str[i] <= 'z'){
//Increments the consonant counter
cCount++;
}
}
printf("Number of vowels : %d\n", vCount);
printf("Number of consonant : %d", cCount);
return 0;
}
Similar questions
Social Sciences,
3 hours ago
Science,
6 hours ago
World Languages,
6 hours ago
Science,
8 months ago
Chemistry,
8 months ago