TOP CRICKETER HOUSE PRICE

Image
TOP CRICKETERS HOUSE IN THE WORLD RICKY POINTING 69.8 CRORE SHANE WATSON  62.8 CRORE YUVRAJ SINGH 60 CRORE MICHEAL CLARKE 59.3 CRORE DAVID WARNER 45.3 CRORE SHANE WARNE 38.4 CRORE SACHIN TENDULKAR 38 CRORE VIRAT KOHLI HOUSE 34 CRORE ROHIT SHARMA 30CR BRETT LEE HOUSE  27.9 CRORE

WHETHER A CHARACTER

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

In this example, you will learn to check whether a character entered by the user is an alphabet or not.
English alphabets
To understand this example, you should have the knowledge of following C programmingtopics:

Example: Program to Check Alphabet

#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: *
* is not an alphabet
In C programming, a character variable holds ASCII value (an integer number between 0 and 127) rather than that character itself.
The ASCII value of lowercase alphabets are from 97 to 122. And, the ASCII value of uppercase alphabets are from 65 to 90.
If the ASCII value of the character entered by the user lies in the range from 97 to 122 or from 65 to 90, that number is an alphabet. In the program,'a' is used instead of 97 and 'z' is used instead of 122. Similarly, 'A' is used instead of 65 and 'Z' is used instead of 90.
You can also check whether a character is an alphabet or not using isalpha() function

Comments

Popular posts from this blog

TECHNICAL INTERVIEW QUESTION

MS DHONI