This program just count the the vowels in the word you type into the program. but I want this program accept only characters not a number. Is there a way?
#include <stdio.h>
#define MAX 50
int countVowel(char[]);
void main()
{
char text[MAX];
int cVowel, sum;
printf("Enter text : ");
scanf("%s", text);
cVowel = countVowel(text);
printf("Text : [%s] has %d vowels", text, cVowel);
}
int countVowel(char t[])
{
int i = 0, count = 0;
while (i < MAX && t[i] != '\0')
{
if (t[i] == 'A' || t[i] == 'a' || t[i] == 'E' || t[i] == 'e'
|| t[i] == 'I' || t[i] == 'i' || t[i] == 'O' || t[i] == 'o'
|| t[i] == 'u' || t[i] == 'U')
count++;
i++;
}
return (count);
}
I've tried using atoi but it didn't work :/