aboutsummaryrefslogtreecommitdiff
path: root/VACC
diff options
context:
space:
mode:
Diffstat (limited to 'VACC')
-rw-r--r--VACC/VowelsAndConsonantCounter.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/VACC/VowelsAndConsonantCounter.c b/VACC/VowelsAndConsonantCounter.c
new file mode 100644
index 0000000..8cf0554
--- /dev/null
+++ b/VACC/VowelsAndConsonantCounter.c
@@ -0,0 +1,31 @@
+# include <stdio.h>
+
+void countConsonantandVowel(char input[1000]) {
+ char vowels[10] = "aeiouAEIOU";
+ int count_vowels = 0;
+ int count_consonants = 0;
+ int spaces = 0;
+ for (int i = 0; input[i] != '\0'; ++i) {
+ int flag_vowel = 0;
+ for (int n = 0; n < 10; ++n) {
+ if (input[i] == vowels[n]) {
+ count_vowels += 1;
+ flag_vowel = 1;
+ break;
+ }
+ }
+ if (input[i] == ' ' || input[i] == '\n' || input[i] == '\t') {
+ spaces += 1;
+ }
+ else if (!flag_vowel) {
+ count_consonants += 1;
+ }
+ }
+ printf("THE VOWELS ARE: %d, THE CONSONANTS ARE: %d, THE WHITE SPACE COUNT: %d\n\n", count_vowels, count_consonants, spaces);
+}
+
+int main () {
+ char INPUT[1000] = "hyder hadi abd-alghani";
+ countConsonantandVowel(INPUT);
+ return 0;
+} \ No newline at end of file