C# 基础语言 if..elsestring tax;decimal taxa;Console.WriteLine("Enter tax Y or N");Input = Console.ReadLine();tax = Convert.ToString(Input);if (tax == Y);{taxa=0.01;}else(tax == N);{taxa=0;}Console.WriteLine(taxa) 题要求输入Y 显示 10输入N 显示 0我好像写的不对,应该如何改呢

问题描述:

C# 基础语言 if..else
string tax;
decimal taxa;
Console.WriteLine("Enter tax Y or N");
Input = Console.ReadLine();
tax = Convert.ToString(Input);
if (tax == Y);
{
taxa=0.01;
}
else(tax == N);
{
taxa=0;
}
Console.WriteLine(taxa)
题要求
输入Y 显示 10
输入N 显示 0
我好像写的不对,应该如何改呢

static void Main(string[] args) { string tax; decimal taxa; Console.WriteLine("Enter tax Y or N"); tax = Console.ReadLine().ToString(); if...