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 ConvertRadiansToDegrees
- {
- class Program
- {
- static void Main(string[] args)
- {
- int a = int.Parse(Console.ReadLine());
- int b = int.Parse(Console.ReadLine());
- string c = Console.ReadLine();
- switch (c)
- {
- case "+":
- Console.WriteLine("{0} + {1} = {2} - {3}", a, b, a + b, (a + b) % 2 == 0 ? "even" : "odd");
- break;
- case "-":
- Console.WriteLine("{0} - {1} = {2} - {3}", a, b, a - b, (a - b) % 2 == 0 ? "even" : "odd");
- break;
- case "*":
- Console.WriteLine("{0} * {1} = {2} - {3}", a, b, a * b, a * b % 2 == 0 ? "even" : "odd");
- break;
- }
- if (b != 0 && c == "%")
- {
- Console.WriteLine("{0} % {1} = {2}", a, b, a % b);
- }
- if (b != 0 && c == "/")
- {
- Console.WriteLine("{0} / {1} = {2:f2}", a, b, (double)a / b);
- }
- switch (b)
- {
- case 0:
- Console.WriteLine("Cannot divide {0} by zero", a);
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement