Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Operations
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numberOne = int.Parse(Console.ReadLine());
- int numberTwo = int.Parse(Console.ReadLine());
- string operation = Console.ReadLine();
- int result = 0;
- string evenOrOdd = null;
- if (operation == "+" || operation == "-" || operation == "*")
- {
- if (operation == "+")
- {
- result = numberOne + numberTwo;
- }
- else if (operation == "-")
- {
- result = numberOne - numberTwo;
- }
- else if (operation == "*")
- {
- result = numberOne * numberTwo;
- }
- if (result % 2 == 0)
- {
- evenOrOdd = "even";
- }
- else
- {
- evenOrOdd = "odd";
- }
- Console.WriteLine("{0} {1} {2} = {3} - {4}", numberOne, operation, numberTwo, result, evenOrOdd);
- }
- if (operation == "/" || operation == "%")
- {
- if (numberTwo == 0)
- {
- Console.WriteLine($"Cannot divide {numberOne} by zero");
- }
- else if (operation == "/")
- {
- Console.WriteLine($"{numberOne} / {numberTwo} = {(double) numberOne / numberTwo}");
- }
- else if (operation == "%")
- {
- Console.WriteLine($"{numberOne} % {numberTwo} = {numberOne % numberTwo}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement