-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasic Calculator- Eads.txt
78 lines (66 loc) · 2.78 KB
/
Basic Calculator- Eads.txt
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
76
77
78
using System.IO;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using nsClearConsole;
class Program
{
static void Main()
{
var operatorOperations = new List<string> { "Null", "Addition", "Subtraction", "Multiplication", "Division", "Added", "Subtracted", "Multiplied", "Divided" };
var Green = ConsoleColor.Green;
Console.ForegroundColor = Green;
Console.WriteLine("|: Basic Calculator :|");
Console.WriteLine("|: Made by Eadrian Basila :|");
Console.WriteLine("");
Console.WriteLine("[Choose your Operation:]");
Console.WriteLine("=======================");
Console.WriteLine("(1) Addition [+].");
Console.WriteLine("(2) Subtraction [-].");
Console.WriteLine("(3) Multiplication [*].");
Console.WriteLine("(4) Division. [/].");
Console.WriteLine("=======================");
Console.WriteLine("");
Console.WriteLine("Enter your Option: ");
int operatorOption = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("");
Console.WriteLine("You've chosen = {0}", operatorOperations[operatorOption]);
System.Threading.Thread.Sleep(1000);
Console.WriteLine("Please enter your first variable to be {0} =", operatorOperations[operatorOption + 4]);
int variableFirst = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please enter your second variable to be {0} =", operatorOperations[operatorOption + 4]);
int variableSecond = Convert.ToInt32(Console.ReadLine());
if (operatorOption == 1)
{
Console.WriteLine("");
int totalVariable = variableFirst + variableSecond;
Console.WriteLine("The sum is = {0}", totalVariable);
}
else if (operatorOption == 2)
{
Console.WriteLine("");
int totalVariable = variableFirst - variableSecond;
Console.WriteLine("The difference is = {0}", totalVariable);
}
else if (operatorOption == 3)
{
Console.WriteLine("");
int totalVariable = variableFirst * variableSecond;
Console.WriteLine("The product is = {0}", totalVariable);
}
else if (operatorOption == 4)
{
Console.WriteLine("");
int totalVariable = variableFirst / variableSecond;
Console.WriteLine("The quotient is = {0}", totalVariable);
}
else
{
Console.WriteLine("[Please choose carefully from the options provided.]");
Console.WriteLine("[ Try Again :( ]");
}
}
}