Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CalculatorInCSharp
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Enter a number: ");
- int num1 = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Enter another number: ");
- int num2 = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Add, subtract, multiply, or divide? (Say in lower case letters)");
- string type = Console.ReadLine();
- if (type == "add")
- {
- Console.WriteLine(num1 + num2);
- } else if (type == "subtract")
- {
- Console.WriteLine(num1 - num2);
- } else if (type == "multiply")
- {
- Console.WriteLine(num1 * num2);
- } else if (type == "divide")
- {
- Console.WriteLine(num1 / num2);
- } else
- {
- Console.WriteLine("That isn't a type of math.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement