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 Operatioans
- {
- class Program
- {
- static void Main(string[] args)
- {
- var N1 = double.Parse(Console.ReadLine());
- var N2 = double.Parse(Console.ReadLine());
- string operat = Console.ReadLine();
- if (operat=="+")
- {
- var sum = N1 + N2;
- if (sum%2==0)
- {
- Console.WriteLine("{0} {1} {2} = {3} - even", N1, operat, N2, sum);
- }
- else
- Console.WriteLine("{0} {1} {2} = {3} - odd", N1, operat, N2, sum);
- }
- if (operat == "-")
- {
- var sum = N1 - N2;
- if (sum % 2 == 0)
- {
- Console.WriteLine("{0} {1} {2} = {3} - even", N1, operat, N2, sum);
- }
- else
- Console.WriteLine("{0} {1} {2} = {3} - odd", N1, operat, N2, sum);
- }
- if (operat == "*")
- {
- var sum = N1 * N2;
- if (sum % 2 == 0)
- {
- Console.WriteLine("{0} {1} {2} = {3} - even", N1, operat, N2, sum);
- }
- else
- Console.WriteLine("{0} {1} {2} = {3} - odd", N1, operat, N2, sum);
- }
- if (operat=="/")
- {
- if (N2!=0)
- {
- Console.WriteLine("{0} {1} {2} = {3:f2}", N1, operat, N2, N1/N2);
- }
- else
- Console.WriteLine("Cannot divide {0} by zero", N1);
- }
- if (operat == "%")
- {
- if (N2 != 0)
- {
- Console.WriteLine("{0} {1} {2} = {3}", N1, operat, N2, N1 % N2);
- }
- else
- Console.WriteLine("Cannot divide {0} by zero", N1);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment