StudyGPT Just Leveled Up – Say Hello to Knowee! 🚀
Knowee
Questions
Features
Study Tools

Write a C program to read an English Alphabet through keyboard and display whetherthe given alphabet is in upper case or lower case.

Question

🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, here is a simple C program that reads an English alphabet from the keyboard and displays whether the given alphabet is in upper case or lower case.

#include <stdio.h>

int main()
{
    char ch;
    printf("Enter a character: ");
    scanf("%c", &ch);

    if(ch >= 'A' && ch <= 'Z')
        printf("%c is an UpperCase character\n", ch);
    else if(ch >= 'a' && ch <= 'z')
        printf("%c is a LowerCase character\n", ch);
    else
        printf("%c is not an alphabetic character\n", ch);

    return 0;
}

This program works by first reading a character from the user. It then checks if the ASCII value of the character is within the range of uppercase or lowercase English alphabets. If it is, it prints that the character is uppercase or lowercase. If it's not within either range, it prints that the character is not an alphabetic character.

This problem has been solved

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.