Logic
If the ASCII value of a character lies between 65 (A) to 90 (Z) then it is an uppercase character or if the character’s ASCII value lies between 97 (a) to 122 (z) then it is a lowercase character.
See also: Find ASCII value of a character
See the flow diagram:
Program
#include <iostream> using namespace std; int main() { char ch; cout << "Enter any character : "; cin >> ch; if(ch >= 'A' && ch <= 'Z') { cout << endl << ch << " is UPPERCASE alphabet."; } else if(ch >= 'a' && ch <= 'z') { cout << endl << ch << " is LOWERCASE alphabet."; } else { cout << endl << ch << " is not an alphabet."; } return 0; }
Output
Enter any character : S
S is UPPERCASE alphabet.