Write a C program to read an English Alphabet through keyboard and display whetherthe given alphabet is in upper case or lower case.
Question
Write a C program to read an English Alphabet through keyboard and display whether the given alphabet is in upper case or lower case.
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.
Similar Questions
Write a program to check whether a given character is Alphabet or not using if else statement Note: Check for both upper and lower case characters
Write a C program to check whether an alphabet is vowel or consonant using switch case
Write a C program to read a sentence and replace lowercase characters with uppercase and vice versa.
Write a program that takes a string of lowercase characters as input and prints it in uppercase, reversed.
Write a program in C to print a string in reverse using a character pointer.Also print the uppercase of the first letter of the reversed word.
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.