10 Mar 2013

Check_CHAR(alpha,num)

/*

program to check given character is alphabet, digit or any other character

*/


#include<iostream.h>
#include<conio.h>


int main()
{
    char a;
    cout <<"Enter a character : \n";
    cin >> a;
    if(((a >= 'A')&&(a<='Z')) || ((a >='a')&&(a <= 'z')))
    cout << "You entered an Alphabet\n";
    else if(a >= '0' && a <='9')
    cout << "You entered a digit\n";
    else
    cout << "You entered non alpha numeric character\n";    getch();
    return 0;
}

Categories: ,

0 comments:

Post a Comment

Copyright © UPgradeCODING | Powered by Blogger