Write C# Program to check uppercase or lowercase alphabets

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..


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. using System;
  2.  
  3. public class charpexercise
  4. {
  5. static void Main(string[] args)
  6. {
  7. char ch;
  8.  
  9. Console.WriteLine("Enter any character: ");
  10. ch = Convert.ToChar(Console.ReadLine());
  11.  
  12. if (ch >= 'a' && ch <= 'z')
  13. {
  14. Console.WriteLine(ch + " is lowercase alphabet ");
  15. }
  16. else if (ch >= 'A' && ch <= 'Z')
  17. {
  18. Console.WriteLine(ch + " is uppercase alphabet ");
  19. }
  20. else
  21. {
  22. Console.WriteLine(ch + " is not an alphabet ");
  23. }
  24.  
  25. Console.ReadLine();
  26. }
  27. }

Result

C# language techstudy.org

     





Related Topics




Popular Posts