-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10 Task.cs
More file actions
38 lines (32 loc) · 1.14 KB
/
10 Task.cs
File metadata and controls
38 lines (32 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
public class MainClass
{
public static void Main()
{
Console.WriteLine("Введите номер операции: 1.Сложение 2.Вычитание 3.Умножение");
string line = Console.ReadLine();
string[] splitString = line.Split(' ');
int operation = Convert.ToInt32(splitString[0]);
double a = Convert.ToDouble(splitString[1]);
double b = Convert.ToDouble(splitString[2]);
double result = 0;
switch(operation)
{
case 1:
result = a + b;
Console.WriteLine($"Результат операции {result}");
break;
case 2:
result = a - b;
Console.WriteLine($"Результат операции {result}");
break;
case 3:
result = a * b;
Console.WriteLine($"Результат операции {result}");
break;
default:
Console.WriteLine("Неизвестная операция!");
break;
}
}
}