using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
Console.Write("Add or Subtract? ");
if (Console.ReadLine().Equals("Add"))
{
input(true);
}
else
{
input(false);
}
}
public static void input(bool operation)
{
Console.Write("Enter Number A: ");
string a = Console.ReadLine();
Console.Write("Enter Number B: ");
string b = Console.ReadLine();
if (operation)
{
Console.WriteLine(a + " + " + b + " = " + add(Int32.Parse(a), Int32.Parse(b)).ToString());
}
else
{
Console.WriteLine(a + " - " + b + " = " + subtract(Int32.Parse(a), Int32.Parse(b)).ToString());
}
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
}
public static int add(int a, int b)
{
return a + b;
}
public static int subtract(int a, int b)
{
return a - b;
}
}
}