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

devquora

Posted On: Jan 27, 2023

### Overview:

In this article, I would like to tell the logic for the C Program to Check Whether a Character is Alphabet or not. But, First of all, let's understand what the Alphabet is. Moreover, I will show a Visual representation of the Alphabet, Vowels,s, and Consonants. After all, I will write the logic and C Program to Check Whether a Character is Vowel or Consonant with output.

### What do you mean by Alphabet?

The Alphabet is a set of letters with which one or more languages are written, especially if arranged in a customary order. The Sequence of each letter in the Alphabet is predefined. For instance, The Sequence A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z is known as the Alphabet that represents the Capital letters in the Alphabet. The Alphabet has a total 26 characters. You can denote these letters as small letters such as a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z but can not change the position of the letter in the Alphabet.

### Logic to Check Whether a Character is Vowel or Consonant

• Step 1: The character entered by the user is stored in variable ch
• Step 2: Compare it with All alphabet's ASCII values. Is it true then print this character is an Alphabet.
• Step 4: Otherwise print this character is not an Alphabet.

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

```#include <stdio.h>

int main()
{
char ch;
printf("\n Please Enter any character: ");
scanf("%c", &ch);

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

return 0;
}

```

The output of the Program with code:

When the above code is executed, It produces the following results:

# is not an Alphabet.

Conclusion:

In this Program, the if…else statement is used to check whether a character entered by the user is alphabet or not? The alphabets A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, and Z are called Alphabet. All other charaters except these 26 letters are not an Alphabet. If User entered any character rather than 26 Alphabet than a print like # is not an alphabet.

Never Miss an Articles from us.

## Related Articles

#### C Program to convert Decimal to Binary Number

A Decimal Number is constructed with any digit from 0 to 9. For instance, 24 is a Decimal Number constructed from the digits 2 and 4. A Binary Number is constructed with digits 0 and 1. For instance, ..

#### C program to reverse a string

This program reversed the entered string that means opposite of the previous string sequence...

#### C program to reverse an Integer number

Are you want a demonstration of The C Program that reverses an Integer number? This Program reversing the sequence of digits in an Integer. After the successful compilation of the program, a message..