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 Operations_Between_Numbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- int N1 = int.Parse(Console.ReadLine());
- int N2 = int.Parse(Console.ReadLine());
- string operatorOne = Console.ReadLine();
- int result = 0;
- string operatorTwo = "";
- if ((operatorOne=="+") || (operatorOne=="-") ||(operatorOne=="*"))
- {
- if (operatorOne=="+")
- {
- result = N1 + N2;
- operatorTwo = "+";
- }
- else if (operatorOne=="-")
- {
- result = N1 - N2;
- operatorTwo = "-";
- }
- else if (operatorOne=="*")
- {
- result = N1 * N2;
- operatorTwo = "*";
- }
- }
- Console.WriteLine($"{N1} {operatorTwo} {N2} = {result} ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement