C Examples

WAP to determine whether Character Entered is capital letter,small letter

The Program in C that determines whether the Character Entered is a capital letter, a small letter, special character is given below:

#include <stdio.h>

int main() {
    char ch;
    printf("Enter a character: ");
    scanf("%c", &ch);

    if (ch >= 'A' && ch <= 'Z')
        printf("'%c' is a capital letter.\n", ch);
    else if (ch >= 'a' && ch <= 'z')
        printf("'%c' is a small letter.\n", ch);
    else if (ch >= '0' && ch <= '9')
        printf("'%c' is a digit.\n", ch);
    else
        printf("'%c' is a special symbol.\n", ch);

    return 0;
}

Output:

Enter a character: 23
‘2’ is a digit.

Pro-Tips💡 

This program prompts the user to enter a character, then uses a series of if-else statements to check the character entered by the user.

If the character is between ‘A’ and ‘Z’ (inclusive) in the ASCII table, it is considered a capital letter.

If the character is between ‘a’ and ‘z’ (inclusive) in the ASCII table, it is considered a small letter.

If the character is between ‘0’ and ‘9’ (inclusive) in the ASCII table, it is considered a digit. If none of the above conditions are met, then the character is considered a special symbol.

Learn C-Sharp ↗

C-sharp covers every topic to learn about C-Sharp thoroughly.

Learn C Programming ↗

C-Programming covers every topic to learn about C-Sharp thoroughly.

Learn C++ Programming↗

C++ covers every topic to learn about C-Sharp thoroughly.

Codeauri is Code Learning Hub and Community for every Coder to learn Coding by navigating Structurally from Basic Programming to Front-End Development, Back-End Development to Database, and many more.

Related Posts

C# Program to Find Sum of Rows & Columns of a Matrix

The Program in C# Program to Find Sum of Rows & Columns of a Matrix is given below: Output: Hello Codeauri Family,enter the number of rows and columns…

C# Program to Calculate Determinant of Given Matrix

The Program in C# Program to Calculate Determinant of Given Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns of the matrix…

C# Program to Find Sum of right Diagonals of a Matrix

The Program in C# Program to Find Sum of right Diagonals of a Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns…

C# Program to Find Transpose of Given Matrix

The Program in C# Program to Find Transpose of Given Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns in the matrix:22Enter…

C# Program for Multiplication of two square Matrices

The Program in C# Program for Multiplication of two square Matrices is given below: Output: Hello Codeauri Family, enter the number of rows/columns in the matrices:2Enter the elements…

C# Program to Delete Element at Desired position From Array

The Program in C# Program to Delete Element at Desired position From Array is given below: Output: Hello Codeauri Family, enter the number of elements in the array:4Enter…

Leave a Reply

Your email address will not be published. Required fields are marked *

Your Journey into Code Begins Now: Discover the Wonders of Basic Programming

X