C++ Online Compiler
Example: C++ Program to Check Whether a Character is Alphabet or Not using If-else
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// C++ Program to Check Whether a Character is Alphabet or Not using If-else #include <iostream> using namespace std; int main() { char x; // To store the input character cout << "-----Enter a character to check itself-----\n"; cin >> x; if ((x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z')) { cout << "\n" << x << " is an alphabet character.\n"; } else { cout << "\n" << x << " is not an alphabet character.\n"; } return 0; }
K
Output
Clear
ADVERTISEMENTS