Advertisement
dinko_dt

Untitled

Jan 20th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace _01._Data_Type_Finder
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. string entry = "";
  11. while (entry != "END")
  12. {
  13. entry = Console.ReadLine();
  14. if (entry == "END") break;
  15. if (Int32.TryParse(entry, out _))
  16. {
  17. Console.WriteLine($"{entry} is integer type");
  18. }
  19. else if (double.TryParse(entry, out _))
  20. {
  21. Console.WriteLine($"{entry} is floating point type");
  22. }
  23. else if (bool.TryParse(entry, out _))
  24. {
  25. Console.WriteLine($"{entry} is boolean type");
  26. }
  27. else if (char.TryParse(entry, out _))
  28. {
  29. Console.WriteLine($"{entry} is character type");
  30. }
  31. else
  32. {
  33. Console.WriteLine($"{entry} is string type");
  34. }
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement