-
Notifications
You must be signed in to change notification settings - Fork 1
/
Count_Vowels_Digits_&_Many_Things.c
41 lines (40 loc) · 1.29 KB
/
Count_Vowels_Digits_&_Many_Things.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdio.h>
int main()
{
char text[100];
int i, vowel = 0, digit = 0, conso = 0, special = 0, space = 0;
fflush(stdin);
printf("\nPlease Enter the Text: ");
gets(text);
for (i = 0; text[i] != '\0'; i++)
{
if ((text[i] >= 'a' && text[i] <= 'z') || (text[i] >= 'A' && text[i] <= 'Z'))
{
if (text[i] == 'a' || text[i] == 'e' || text[i] == 'i' || text[i] == 'o' || text[i] == 'u' || text[i] == 'A' || text[i] == 'E' || text[i] == 'I' || text[i] == 'O' || text[i] == 'U')
{
vowel++;
}
else
{
conso++;
}
}
else if (text[i] >= '0' && text[i] <= '9')
{
digit++;
}
else if (text[i] == ' ')
space++;
else
{
special++;
}
}
printf("\n The Text Contains: \n");
printf("\n No. of Words in the Text is: %d", space + 1);
printf("\n No. of Vowels in the Text is: %d", vowel);
printf("\n No. of Consonants in the Text is: %d", conso);
printf("\n No. of Digits in the Text is: %d", digit);
printf("\n No. of Special Symbols in the Text is: %d", special);
printf("\n No. of Space in the Text is: %d", space);
}