43 lines
1.5 KiB
C#
43 lines
1.5 KiB
C#
using System;
|
|
|
|
namespace ConsoleApp1
|
|
{
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
int num1 = 0;
|
|
int num2 = 0;
|
|
Console.WriteLine("Приветствую в калькуляторе!");
|
|
Console.WriteLine("Введите первое число");
|
|
num1 = Convert.ToInt32(Console.ReadLine());
|
|
|
|
Console.WriteLine("Введите второе число");
|
|
num2 = Convert.ToInt32(Console.ReadLine());
|
|
|
|
Console.WriteLine("\ta - Сложение");
|
|
Console.WriteLine("\tb - Вычитание");
|
|
Console.WriteLine("\tc - Умножение");
|
|
Console.WriteLine("\td - Деление");
|
|
|
|
switch (Console.ReadLine())
|
|
{
|
|
case "a":
|
|
Console.WriteLine($"Ваш результат: {num1} + {num2} = " + (num1 + num2));
|
|
break;
|
|
case "b":
|
|
Console.WriteLine($"Ваш результат: {num1} - {num2} = " + (num1 - num2));
|
|
break;
|
|
case "c":
|
|
Console.WriteLine($"Ваш результат: {num1} * {num2} = " + (num1 * num2));
|
|
break;
|
|
case "d":
|
|
Console.WriteLine($"Ваш результат: {num1} / {num2} = " + (num1 / num2));
|
|
break;
|
|
}
|
|
Console.WriteLine("Нажмите любую клавишу");
|
|
Console.ReadKey();
|
|
}
|
|
}
|
|
}
|