About Lesson
Develop a program that takes a character as input and determines whether it’s an uppercase letter, lowercase letter, or a digit.
#include <stdio.h>
int main() {
// Declare variable
char character;// Input: Get a character from the user
printf(“Enter a character: “);
scanf(” %c”, &character); // Note the space before %c to consume any previous newline character// Process: Determine the character case
if (character >= ‘A’ && character <= ‘Z’) {
printf(“%c is an uppercase letter.n”, character);
} else if (character >= ‘a’ && character <= ‘z’) {
printf(“%c is a lowercase letter.n”, character);
} else if (character >= ‘0’ && character <= ‘9’) {
printf(“%c is a digit.n”, character);
} else {
printf(“%c is not an uppercase letter, lowercase letter, or a digit.n”, character);
}return 0; // Exit the program successfully
}