Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace MyApp // Note: actual namespace depends on the project name.
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- double n1 = double.Parse(Console.ReadLine());
- double n2 = double.Parse(Console.ReadLine());
- string sinvol =Console.ReadLine();
- double result = 0;
- if (sinvol == "+")
- {
- result = n1 + n2;
- if (result % 2 == 0)
- {
- Console.WriteLine($"{n1} + {n2} = {result} - even");
- }
- else if (result % 2 != 0)
- {
- Console.WriteLine($"{n1} + {n2} = {result} - odd");
- }
- }
- else if (sinvol == "-")
- {
- result = n1 - n2;
- if (result % 2 == 0)
- {
- Console.WriteLine($"{n1} - {n2} = {result} - even");
- }
- else if (result % 2 != 0)
- {
- Console.WriteLine($"{n1} - {n2} = {result} - odd");
- }
- }
- else if (sinvol == "*")
- {
- result = n1 * n2;
- if (result % 2 == 0)
- {
- Console.WriteLine($"{n1} * {n2} = {result} - even");
- }
- else if (result % 2 != 0)
- {
- Console.WriteLine($"{n1} * {n2} = {result} - odd");
- }
- }
- else if (sinvol == "/")
- {
- if (n2 == 0)
- {
- Console.WriteLine($"Cannot divide {n1} by zero");
- }
- else if (n2 != 0)
- {
- result= n1 / n2 ;
- Console.WriteLine($"{n1} / {n2} = {result:f2}");
- }
- }
- else if (sinvol == "%")
- {
- if (n2 == 0)
- {
- Console.WriteLine($"Cannot divide {n1} by zero");
- }
- else if (n2 != 0)
- {
- result = n1 % n2;
- Console.WriteLine($"{n1} % {n2} = {result}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement