// Storage
int value1 = 0;
int value2 = 0;
int total = 0;
string operation;
// Get first number
value1 = GetNumber();
// Get Operation
Console.Write("What operation would you like to perform: ");
operation = Console.ReadLine();
// Get second number
value2 = GetNumber();
// Perform the operation
if (operation == "+")
total = value1 + value2; // Addition
else if (operation == "-")
total = value1 - value2; // Subtraction
else if (operation == "/")
total = value1 / value2; // Division
else if (operation == "*")
total = value1 * value2; // Multiplication
else
{
// Ignore other keypresses
}
// Output the answer
Console.WriteLine("The total is {0}", total);
Subscribe to:
Post Comments (Atom)
Popular 5 Posts Last 7 days
-
How CLR executes a DLL file. 1. CLR will be loaded into memory 2. CLR loads a Manifest 3. CLR loads Type Info. 4. ...
-
The .NET languages In the past, you chose the development language for an application based upon the functionality that you were trying to p...
-
Assembly : - Assembly is a collection of classes developed in different languages & packaged as DLL to achieve a task. Assembly Arch...
No comments:
Post a Comment