Advertisement
Guest User

Problem 9

a guest
Dec 13th, 2015
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace task_9
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("Please choose a type: ");
  14.             string type = Console.ReadLine();
  15.             switch (type)
  16.             {
  17.                 case "1": Console.WriteLine("Please enter a integer: ");
  18.                     int input1 = int.Parse(Console.ReadLine());
  19.                     int result1 = input1 + 1;
  20.                     Console.WriteLine(result1);
  21.                     break;
  22.                 case "2": Console.WriteLine("Please enter a double: ");
  23.                     double input2 = double.Parse(Console.ReadLine());
  24.                     double result2 = input2 + 1;
  25.                     Console.WriteLine(result2);
  26.                     break;
  27.                 case "3": Console.WriteLine("Please enter a string: ");
  28.                     string input3 = Console.ReadLine();
  29.                     string result3 = input3 + "*";
  30.                     Console.WriteLine(result3);
  31.                     break;
  32.                 default: Console.WriteLine("Non a type!!!"); break;
  33.             }
  34.  
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement