Solved programming problem

Find Which Key User Press in The Key Board in C

Source code

#include <stdio.h>

int main()

{

    char c;

    printf("Please Enter a button of your keyboard: ");

    scanf("%c",&c);

    if ((c==97) || (c==65) || (c==105) || (c==73) || (c==103) || (c==71) || (c==111) || (c==79) || (c==117) || (c==85)) ///for vowel

    {

        printf("You enter a vowel.
");

    }

    else if ((c>=65 && c<=90) || (c>=97 && c<=122)) ///for Alphabet

    {

        printf("You press a Alphabet.
");

    }

    else if (c>=48 && c<=57) ///for digit

    {

        printf("You press a digit.
");

    }

    else ///for others

    {

        printf("You press a other button.
");

    }

    return 0;

}

Output

Please Enter a button of your keyboard:a

v.

Join the discussion

Add your comment