Добавьте файлы проекта.
This commit is contained in:
42
ConsoleApp1/Program.cs
Normal file
42
ConsoleApp1/Program.cs
Normal file
@ -0,0 +1,42 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user