Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Data_Types
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string type = Console.ReadLine();
  10.  
  11. switch (type)
  12. {
  13. case "int":
  14. int inputInt = int.Parse(Console.ReadLine());
  15. GetResult(inputInt);
  16. break;
  17. case "real":
  18. double inputDouble = double.Parse(Console.ReadLine());
  19. GetResult(inputDouble);
  20. break;
  21. case "string":
  22. string inputString = Console.ReadLine();
  23. GetResult(inputString);
  24. break;
  25. }
  26. }
  27.  
  28. private static void GetResult(string inputString)
  29. {
  30. Console.WriteLine($"${inputString}$");
  31. }
  32.  
  33. private static void GetResult(double inputDouble)
  34. {
  35. Console.WriteLine($"{(inputDouble * 1.5):f2}");
  36. }
  37.  
  38. private static void GetResult(int inputInt)
  39. {
  40. Console.WriteLine(inputInt * 2);
  41. }
  42.  
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement