Write C# Program to check uppercase or lowercase alphabets

Introduction

Write C# Program to check uppercase or lowercase alphabets. I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability..

using System;
 
public class charpexercise
{
    static void Main(string[] args)
    {
        char ch;
 
        Console.WriteLine("Enter any character: ");
        ch = Convert.ToChar(Console.ReadLine());        
 
        if (ch >= 'a' && ch <= 'z')
        {
            Console.WriteLine(ch + " is lowercase alphabet ");            
        }
        else if (ch >= 'A' && ch <= 'Z')
        {
            Console.WriteLine(ch + " is uppercase alphabet ");                      
        }
        else
        {
            Console.WriteLine(ch + " is not an alphabet ");                      
        }
 
        Console.ReadLine();
    }
}

Result

Write C# Program to check uppercase or lowercase alphabets
Write C# Program to check uppercase or lowercase alphabets

Leave a Comment