Tech Study

Write C# Program to check whether a character is alphabet, digit or special character

Introduction

Write C# Program to check whether a character is alphabet, digit or special character. 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());
 
        // Alphabet checking condition
        if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
        {
            Console.WriteLine(ch + "is an Alphabet. ");            
        }
        else if (ch >= '0' && ch <= '9')
        {         
            Console.WriteLine(ch + "is a Digit. ");
        }
        else
        {
            Console.WriteLine(ch + "is a Special character.. ");            
        } 
 
        Console.ReadLine();
    }
}

Result

Write C# Program to check whether a character is alphabet, digit or special character
Write C# Program to check whether a character is alphabet, digit or special character

Taggeddigit or special characterWrite C# Program to check whether a character is alphabet

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more