How to check if a character is a vowel in C

1 Answer

0 votes
#include <stdio.h>

int main() {
    char ch = 'a';

    switch(ch) {
        case 'a':
        case 'A':
        case 'e':
        case 'E':
        case 'i':
        case 'I':
        case 'o':
        case 'O':
        case 'u':
        case 'U':
            printf("%c is vowel\n", ch);
            break;
        default:
            printf("%c is not vowel\n", ch);
    }

    return 0;
}



/*
run:

a is vowel

*/

 



answered Jun 30, 2019 by avibootz

Related questions

3 answers 265 views
1 answer 149 views
1 answer 85 views
85 views asked Jan 2, 2025 by avibootz
3 answers 247 views
1 answer 183 views
...