1. 程式人生 > >課後作業二

課後作業二

system ner cas () 作業二 .text eap oid 符號

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int n = 0;
int m = 0;
int result = 0;
string sign;

Console.WriteLine("請輸入一個數:");
n = int.Parse(Console.ReadLine());
Console.WriteLine("再輸入一個數: ");
m = int.Parse(Console.ReadLine());
Console.WriteLine("請輸入運算符號:");
sign = Console.ReadLine();
switch (sign)
{
case "+":
result = n + m;
break;
case "-":
result = n - m;
break;
case "*":
result = n * m;
break;
case "/":
result = n / m;
break;
}
Console.WriteLine("結果是:" + result.ToString());


Console.ReadKey();


}



}
}

課後作業二