Alphabet or Not C++ Program - Learn Engineering

All the news and updates relevant to Engineering. You can also Write a post here

Breaking

Friday, June 12, 2020

Alphabet or Not C++ Program


C++ PROGRAM TO CHECK WHETHER THE CHARACTER IS AN ALPHABET OR NOT

Sample Test Case                                   Sample Output


A                                                              A is an Alphabet   

6                                                               6 is not an Alphabet                                        

CODE


#include <iostream.h>
using namespace std;
int main()
{
    char ch;
    cout<<"Enter a Character :";
    cin>>ch;
    if((ch>='a' && ch<='z')||(ch>='A' && ch<='Z'))
    {
    cout<<ch<<" is an Alphabet";
    }
    else
    {
    cout<<ch<<" is not an Alphabet";
    }
    return 0;
}


No comments:

Post a Comment