Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using static System.Console;
- namespace The_begining
- {
- class Program
- {
- static void Main(string[] args)
- {
- decimal N1 = decimal.Parse(Console.ReadLine());
- decimal N2 = decimal.Parse(Console.ReadLine());
- string symbol = Console.ReadLine();
- decimal result = 0.00M;
- string output = string.Empty;
- if (N2 == 0 && (symbol.Equals("/") || symbol.Equals("%")))
- {
- output = string.Format("Cannot divide {0} by zero", N1);
- }
- else if (symbol.Equals("/"))
- {
- result = N1 / N2;
- output = string.Format("{0} {1} {2} = {3:F2}", N1, symbol, N2, result);
- }
- else if (symbol.Equals("%"))
- {
- result = N1 % N2;
- output = string.Format("{0} {1} {2} = {3}", N1, symbol, N2, result);
- }
- else
- if (symbol.Equals("+"))
- {
- result = N1 + N2;
- }
- else if (symbol.Equals("-"))
- {
- result = N1 - N2;
- }
- else if (symbol.Equals("*"))
- {
- result = N1 * N2;
- }
- output = string.Format("{0} {1} {2} = {3} - {4}", N1, symbol, N2, result, result % 2 == 0
- ? "even" : "odd");
- Console.WriteLine(output);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement