C PROGRAMMING PROGRAM • DECISION MAKING
Check Uppercase or Lowercase Alphabet
Learn how to check uppercase or lowercase alphabet using a clear C program.
PROBLEM UNDERSTANDING
Input and expected output
Sample input
g
Sample output
Lowercase alphabet
COMPLETE C PROGRAM
Complete C implementation
#include <stdio.h>
#include <ctype.h>
int main(void)
{
char character;
printf("Enter an alphabet: ");
scanf(" %c", &character);
if (isupper((unsigned char) character))
printf("Uppercase alphabet\n");
else if (islower((unsigned char) character))
printf("Lowercase alphabet\n");
else
printf("Not an alphabet\n");
return 0;
}CURRENT STEP
SELECTED LINE
EXPECTED OUTPUT FOR THE SAMPLE
Lowercase alphabet
Step 0 of 0
PROGRAM EXPLANATION
Algorithm and explanation
- Read the required input values.
- Use isupper() and islower() rather than relying on manual ASCII ranges.
- Display the computed result.
Use isupper() and islower() rather than relying on manual ASCII ranges.
EFFICIENCY
Time and space complexity
Time complexity
O(1)
Auxiliary space
O(1)
DEBUGGING CHECKLIST
Common mistakes
Check this
Use the correct format specifier for every variable.
Check this
Initialize variables before using their values.
Check this
Check braces, semicolons and input order carefully.
Try it yourself
Practice: Run the program with the sample input, predict its output, and then test one boundary case of your own.
