Monday, May 27, 2019

A Character is an Alphabet or not

C Program to Check Whether a Character is an Alphabet or not

Program:

#include <stdio.h>
int main()
{
    char c;
    printf("Enter a character: ");
    scanf("%c",&c);

    if( (c>='a' && c<='z') || (c>='A' && c<='Z'))
        printf("%c is an alphabet.",c);
    else
        printf("%c is not an alphabet.",c);

    return 0;

}
---------------------------------------------------------------------------
Output:

Enter a character: g
g is an alphabet.
--------------------------------
Process exited after 3.156 seconds with return value 0
Press any key to continue . . .

0 Comments:

Post a Comment