-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
75 lines (48 loc) · 1.88 KB
/
Program.cs
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
namespace ConsoleApp2
{
internal class Programm
{
static void RMain(string[] args)
{
bool squaring;
Console.WriteLine("Do you want to square a number? yes/no");
string square = Console.ReadLine();
if (square == "yes") squaring = true;
else if (square == "no") squaring = false;
if (squaring = false)
{
Console.WriteLine("Enter your first number:");
string inp1 = Console.ReadLine();
int num1 = Convert.ToInt32(inp1);
Console.WriteLine("Enter your second number:");
string inp2 = Console.ReadLine();
int num2 = Convert.ToInt32(inp2);
Console.WriteLine("Gib eine Operation (+ - / * )");
string operation = Console.ReadLine();
if (operation == "+")
{
Console.WriteLine(num1 + num2);
}
else if (operation == "-")
{
Console.WriteLine(num1 - num2);
}
else if (operation == "/")
{
Console.WriteLine(num1 / num2);
}
else if (operation == "*")
{
Console.WriteLine(num1 * num2);
}
}
else if (squaring = true)
{
Console.WriteLine("Enter your number:");
string number = Console.ReadLine();
double numberToSquare = Convert.ToDouble(number);
Console.WriteLine(numberToSquare * numberToSquare);
}
}
}
}