C Program to Check Whether Character is Lowercase or Not

How to check whether the given character is a lowercase alphabet or not using islower built-in function and not using islower function. In C Programming, islower is a built-in function, used to check whether the character is a lowercase alphabet or not.

C Program to Check Whether Character is Lowercase or Not using islower function

This C program allows the user to enter any character and finds whether the character is a lowercase alphabet or not

#include <stdio.h>
#include <ctype.h>

int main()
{
  char Ch;
 
  printf("\n Please Enter any alphabet\n");
  scanf("%c", &Ch);

  if ( islower(Ch) )
   {  
     printf ("\n Entered character is lowercase alphabet");
   }
  else
   {
     printf("\n Entered character is Not lowercase alphabet");
   }  
}
character is Lowercase or not Using islower function

In this C Program to Check Whether Character is Lowercase, we used the If Statement,

if (islower(Ch))

If the above condition islower(Ch) is TRUE, the given character is a lowercase alphabet. So, C programming will print the below statement

printf ("\n Entered character is lowercase alphabet");

If the above condition islower(Ch) is FALSE, the given character is not lowercase alphabet. So, it will print the below statement

printf ("\n Entered character is Not lowercase alphabet");

Program to Check Whether Character is Lowercase or Not without using islower function

This program allows the user to enter any character and check whether the character is a lowercase alphabet or not without using islower function.

#include <stdio.h>

int main()
{
  char Ch;

  printf("\n Please Enter any alphabet\n");
  scanf("%c", &Ch);

  if (Ch >= 'a' && Ch <= 'z')
   {  
     printf ( "\nEntered character is lowercase alphabet") ;
   }
  else
   {
     printf("\nEntered character is Not lowercase alphabet");
   }  
}
 Please Enter any alphabet
l

Entered character is lowercase alphabet

Let us check with a false value

 Please Enter any alphabet
L

Entered character is Not lowercase alphabet

Within this C Program for Lowercase, If you look at the If Statement

 if (Ch >= 'a' && Ch <= 'z')

As we all know, all the lowercase characters are between a and z. So, the above if condition will check whether the given character is between a and z.

If the above condition (Ch >= ‘a’ && Ch <= ‘z’)is TRUE, the given character is a lowercase alphabet. So, it will print the below statement

printf ("\n Entered character is lowercase alphabet");

If the above condition (Ch >= ‘a’ && Ch <= ‘z’) is FALSE, the given character is not lowercase alphabet. So, it will print the below printf statement

printf ("\n Entered character is Not lowercase alphabet");

C Program to Check Whether Character is Lowercase or Not using ASCII Values

This C program finds whether the character is a lowercase alphabet or not without using islower function.

#include <stdio.h>

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

  if (Ch >= 97 && Ch <= 122)
   {  
     printf ( "\nEntered character is lowercase alphabet") ;
   }
  else
   {
     printf("\nEntered character is Not lowercase alphabet");
   }  
}
 Please Enter any character
z

Entered character is lowercase alphabet

In this c lowercase program, If you look at the If Statement

if (Ch >= 97 && Ch <= 122)

As we all know, the ASCII values of all the lowercase characters are between 97 and 122. So, the above if condition will check whether the given character is between 97 and 122.

If the above condition if (Ch >= 97 && Ch <= 122) is TRUE, the given character is a lowercase alphabet. So, it will print the below printf statement

printf ("\n Entered character is lowercase alphabet");

If the above condition if (Ch >= 97 && Ch <= 122) is FALSE, the given character is not lowercase alphabet. So, it will print the below statement

printf ("\n Entered character is Not lowercase alphabet");