C Program to Check Whether an Alphabet is in Uppercase or Lowercase (अल्फाबेट अपरकेस है या लोअरकेस, चेक करने का प्रोग्राम)

In C language, uppercase alphabets range from A to Z, and lowercase alphabets range from a to z. This program checks whether the character entered by the user is an uppercase letter, lowercase letter, or not an alphabet.

C लैंग्वेज में Uppercase alphabets A से Z तक तथा Lowercase alphabets a से z तक होते हैं। यह प्रोग्राम यूजर द्वारा enter किए गए character को चेक करता है कि वह uppercase letter है, lowercase letter है या alphabet नहीं है।

C Program

#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
clrscr();
printf("Enter an alphabet\n");
scanf("%c",&ch);
if(ch>=65 && ch<=90)
printf("%c is in Upper Case or Capital Letter\n",ch);
else
{
if(ch>=97 && ch<=122)
printf("%c is Lower Case or Small Letter\n",ch);
else
printf("%c is not an alphabet\n",ch);
}
getch();
}

Output

Output 1: Uppercase Alphabet

Enter an alphabet
A
A is in Upper Case or Capital Letter

Output 2: Lowercase Alphabet

Enter an alphabet
b
b is Lower Case or Small Letter

Output 3: Not an Alphabet

Enter an alphabet
5
5 is not an alphabet

Explanation

In this program, the character entered by the user is stored in the variable ch.

इस प्रोग्राम में यूजर द्वारा enter किए गए character को ch वेरिएबल में store किया जाता है।

  • If ch is between 65 and 90, it is an uppercase alphabet (A–Z). यदि ch की value 65 से 90 के बीच है, तो यह uppercase alphabet (A–Z) है।

  • If ch is between 97 and 122, it is a lowercase alphabet (a–z). यदि ch की value 97 से 122 के बीच है, तो यह lowercase alphabet (a–z) है।

  • Otherwise, it is not an alphabet. अन्यथा यह alphabet नहीं है।

The && operator is used to check both conditions together, and the if-else statement is used for decision-making.

दोनों conditions को एक साथ चेक करने के लिए && ऑपरेटर तथा decision-making के लिए if-else statement का प्रयोग किया गया है।

This program demonstrates the use of character input, relational operators, logical operators, and if-else statements in C language.

यह प्रोग्राम C लैंग्वेज में character input, relational operators, logical operators तथा if-else statements के प्रयोग को प्रदर्शित करता है।

Comments

Popular posts from this blog

C Language Topics in Hindi and English

Complete C Programming Syllabus | Advanced C Roadmap for Students

Top High-Paying Tech Skills to Learn in 2025