Learn about Check Character is an Uppercase Alphabet or not using If Else Program in C in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
C Program Check Character is an Uppercase Alphabet or not
The below C program checks whether the given Character is Uppercase or not. The ASCII values of the characters are used to check the character and result is displayed.
Source code:
#include<stdio.h>
int main()
{
char ch;
printf("Enter a character: ");
scanf("%c",&ch);
if(ch>=65 && ch<=90)
{
printf("%c is an uppercase alphabet.",ch);
}
else
{
printf("%c is not an uppercase alphabet.",ch);
}
return 0;
}
Output:
Enter a character: F
F is an uppercase alphabet.
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Codes :
Program to Evaluate the Result of a Student
Check Candidate is Eligible for Voting or Not in C