using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication40
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("請(qǐng)選擇你要的運(yùn)算:1.加法 2.減法 3.乘法 4.除法");
int yun = Convert.ToInt32(Console.ReadLine());
int[] shu = new int[2];
for (int i = 0; i < shu.Length; i++)
{
Console.Write("請(qǐng)輸入第{0}個(gè)數(shù)字:", i + 1);
shu[i] = Convert.ToInt32(Console.ReadLine());
}
if (yun == 1)
{
Console.Write("運(yùn)算結(jié)果為{0}", jia(shu));
}
else if (yun == 2)
{
Console.Write("運(yùn)算結(jié)果為{0}", jian(shu));
}
else if (yun == 3)
{
Console.Write("運(yùn)算結(jié)果為{0}", cheng(shu));
}
else if (yun == 4)
{
Console.Write("運(yùn)算結(jié)果為{0}", chu(shu));
}
Console.ReadKey();
}
static double jia(int[] arr)
{
double sum = 0;
double num = 0;
for (int i = 0; i < 1; i++)
{
sum += arr[i];
num += arr[i + 1];
}
return num + sum;
}
static double jian(int[] arr)
{
double sum = 0;
double num = 0;
for (int i = 0; i < 1; i++)
{
sum += arr[i];
num += arr[i + 1];
}
return sum - num;
}
static double cheng(int[] arr)
{
double sum = 0;
double num = 0;
for (int i = 0; i < 1; i++)
{
sum += arr[i];
num += arr[i + 1];
}
return sum * num;
}
static double chu(int[] arr)
{
double sum = 0;
double num = 0;
for (int i = 0; i < 1; i++)
{
sum += arr[i];
num += arr[i + 1];
}
return sum / num;
}
}
}