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 OperationsBetweenNumbers
- {
- class OperationsBetweenNumbers
- {
- static void Main(string[] args)
- {
- double n1 = double.Parse(Console.ReadLine());
- double n2 = double.Parse(Console.ReadLine());
- char symbol = char.Parse(Console.ReadLine());
- double result = 0;
- double ostatak = 0;
- string evenORodd = string.Empty;
- ;
- if (symbol == '+' || symbol =='-' || symbol == '*')
- {
- if (n1 % 2 == 0 && n2 % 2 == 0)
- {
- evenORodd = "even";
- Console.WriteLine($"{n1}{symbol}{n2} = {result} - {evenORodd}");
- }
- else if (n1 % 10 == 5 && n2 % 10 == 5)
- {
- evenORodd = "odd";
- Console.WriteLine($"{n1}{symbol}{n2} = {result} - {evenORodd}");
- }
- }
- else if (symbol == '/') Console.WriteLine($"{n1} / {n2} = {Math.Round(result,2)}");
- else if (symbol == '%') Console.WriteLine($"{n1} % {n2} = {ostatak}");
- else if (symbol == '/' || symbol == '%' && n2 != 0) Console.WriteLine($"Cannot divide {n1} by zero");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement