Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.79 KB | None | 0 0
  1. Console.ForegroundColor = ConsoleColor.Yellow;
  2.             Console.Title("Калькулятор");
  3.             Console.WriteLine("Выберите тип калькуляции:");
  4.             Console.WriteLine("1. Сложение");
  5.             Console.WriteLine("2. Вычитание");
  6.             Console.WriteLine("3. Умножение");
  7.             Console.WriteLine("4. Деление");
  8.             Console.Write("Тип: ");
  9.             string type = Console.ReadLine();
  10.             if(type == "1")
  11.             {
  12.                 Console.Clear();
  13.                 Console.ForegroundColor = ConsoleColor.DarkYellow;
  14.                 Console.Write("Первое: ");
  15.                 string first = Console.ReadLine();
  16.                 Console.Write("Второе: ");
  17.                 string post = Console.ReadLine();
  18.                 int fst = Convert.ToInt32(first);
  19.                 int pst = Convert.ToInt32(post);
  20.                 Console.WriteLine(String.Format("Получилось: {0}", fst + pst));
  21.                 Console.ReadKey();
  22.             }
  23.             if(type == "2")
  24.             {
  25.                 Console.Clear();
  26.                 Console.ForegroundColor = ConsoleColor.DarkYellow;
  27.                 Console.Write("Первое: ");
  28.                 string first = Console.ReadLine();
  29.                 Console.Write("Второе: ");
  30.                 string post = Console.ReadLine();
  31.                 int fst = Convert.ToInt32(first);
  32.                 int pst = Convert.ToInt32(post);
  33.                 Console.WriteLine(String.Format("Получилось: {0}", fst - pst));
  34.                 Console.ReadKey();
  35.             }
  36.             if(type == "3")
  37.             {
  38.                 Console.Clear();
  39.                 Console.ForegroundColor = ConsoleColor.DarkYellow;
  40.                 Console.Write("Первое: ");
  41.                 string first = Console.ReadLine();
  42.                 Console.Write("Второе: ");
  43.                 string post = Console.ReadLine();
  44.                 int fst = Convert.ToInt32(first);
  45.                 int pst = Convert.ToInt32(post);
  46.                 Console.WriteLine(String.Format("Получилось: {0}", fst * pst));
  47.                 Console.ReadKey();
  48.             }
  49.             if(type == "4")
  50.             {
  51.                 Console.Clear();
  52.                 Console.ForegroundColor = ConsoleColor.DarkYellow;
  53.                 Console.Write("Первое: ");
  54.                 string first = Console.ReadLine();
  55.                 Console.Write("Второе: ");
  56.                 string post = Console.ReadLine();
  57.                 int fst = Convert.ToInt32(first);
  58.                 int pst = Convert.ToInt32(post);
  59.                 Console.WriteLine(String.Format("Получилось: {0}", fst / pst));
  60.                 Console.ReadKey();
  61.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement