Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Data_Types
- {
- class Program
- {
- static void Main(string[] args)
- {
- string type = Console.ReadLine();
- switch (type)
- {
- case "int":
- int inputInt = int.Parse(Console.ReadLine());
- GetResult(inputInt);
- break;
- case "real":
- double inputDouble = double.Parse(Console.ReadLine());
- GetResult(inputDouble);
- break;
- case "string":
- string inputString = Console.ReadLine();
- GetResult(inputString);
- break;
- }
- }
- private static void GetResult(string inputString)
- {
- Console.WriteLine($"${inputString}$");
- }
- private static void GetResult(double inputDouble)
- {
- Console.WriteLine($"{(inputDouble * 1.5):f2}");
- }
- private static void GetResult(int inputInt)
- {
- Console.WriteLine(inputInt * 2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement