C Language - Checking input Character is Vowel or Consonant

 



/**

 * C program to check whether a character is vowel or consonant

 */


#include <stdio.h>


int main()

{

    char ch;

    

    int i = 1;

    

    while (i<=1000){


    /* Input character from user */

    printf("Enter any character:\n ");

    scanf("%c", &ch);



    /* Condition for vowel */

    if(ch== 'a' || ch=='e' || ch=='i' || ch=='o' || ch=='u' || 

       ch=='A' || ch=='E' || ch=='I' || ch=='O' || ch=='U')

    {

        printf("'%c' is Vowel.\n", ch);

    }

    else if((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))

    {

        /* Condition for consonant */

        printf("'%c' is constant.\n", ch);

    }

   i++;


}

    return 0;

}


//Screeshots:





Comments

Popular Posts