Advertisement
Spocoman

01. Data Types

Jan 30th, 2022 (edited)
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. using System;
  2.  
  3. namespace DataTypes
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string dataTypes = Console.ReadLine();
  10.             string input = Console.ReadLine();
  11.  
  12.             Console.WriteLine(PrintTypeResult(dataTypes, input));
  13.         }
  14.  
  15.         static string PrintTypeResult(string dt, string i)
  16.         {
  17.             return
  18.                 dt == "string" ? $"${i}$" :
  19.                 dt == "int"? $"{int.Parse(i) * 2}" :
  20.                 $"{double.Parse(i) * 1.5:f2}";
  21.         }
  22.     }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement