-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
36 lines (34 loc) · 1.51 KB
/
Program.cs
File metadata and controls
36 lines (34 loc) · 1.51 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
using System.Reflection.Metadata;
class Program
{
private static void Main(string[] args)
{
while (true) {
while (true)
{
Console.Write("Hello and Welcome to the andrecodes simple calculator! \n\nPlease start by entering a number: ");
int num1 = Convert.ToInt32(Console.ReadLine());
Console.Write("Please enter another number: ");
int num2 = Convert.ToInt32(Console.ReadLine());
Console.Write("Please enter your desired operation (mult, add, sub, div: ");
string operation = Console.ReadLine();
if (operation == "mult")
Console.Write("Your result is: " + (num1 * num2));
if (operation == "add")
Console.Write("Your result is: " + (num1 + num2));
if (operation == "sub")
Console.Write("Your result is: " + (num1 - num2));
if (operation == "div")
Console.Write("Your result is: " + (num1 / num2));
Console.Write("\nDo you wish to calculate something else? (yes/no): ");
string answer = Console.ReadLine();
Console.Write('\n');
if (answer == "yes")
break;
if (answer == "no")
Console.WriteLine("Thank you for using my calcultor.\nSee you next time!");
return;
}
}
}
}