Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace MathOperations
- {
- class Program
- {
- static void Main(string[] args)
- {
- int num1 = int.Parse(Console.ReadLine());
- string operat0r = Console.ReadLine();
- int num2 = int.Parse(Console.ReadLine());
- Calculate(num1, operat0r, num2);
- }
- static int Calculate(int num1, string operat0r, int num2)
- {
- int sum = 0;
- switch (operat0r)
- {
- case "+":
- sum = num1 + num2;
- break;
- case "/":
- sum = num1 / num2;
- break;
- case "*":
- sum = num1 * num2;
- break;
- case "-":
- sum = num1 - num2;
- break;
- }
- Console.WriteLine(sum);
- return sum;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement