Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. Private void TestInput()
  2. {
  3. Console.Write("Enter a character >\t");
  4. char ch = (char)Console.Read();
  5. Console.WriteLine("");
  6.  
  7. if(Char.IsLetter(ch))
  8. {
  9. if(Char.IsUpper(ch))
  10. {
  11. Console.WriteLine("You have entered an upper case character");
  12. }
  13. else
  14. {
  15. Console.WriteLine("You have entered a lower case character");
  16. }
  17. }
  18. else if(Char.IsNumber(ch))
  19. {
  20. Console.WriteLine("You have entered a numeric character");
  21. }
  22. else
  23. {
  24. Console.WriteLine("You have entered a non alpha-numeric character");
  25. }
  26.  
  27. Console.Read();
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement