C# 使用if-else查找三个中的最大数。为什么没有';我不想编译?

C# 使用if-else查找三个中的最大数。为什么没有';我不想编译?,c#,if-statement,C#,If Statement,我是一名编程新手,我真的很想知道我的错误是什么: static void Main(string[] args) { int a = int.Parse(Console.ReadLine()); int b = int.Parse(Console.ReadLine()); int c = int.Parse(Console.ReadLine()); if ((a > b) && (a > c)) { Consol

我是一名编程新手,我真的很想知道我的错误是什么:

static void Main(string[] args)
{
    int a = int.Parse(Console.ReadLine());
    int b = int.Parse(Console.ReadLine());
    int c = int.Parse(Console.ReadLine());

    if ((a > b) && (a > c))
    {
       Console.WriteLine(a);
    }
    else
    {
       if ((b > a) && (b > c)) ;
       {
          Console.WriteLine(b);
       }
       else
       {
          Console.WriteLine(c);
       }
    }
}

删除

您不能在您的if条件下使用
。移除它

if ((b > a) && (b > c))
{
      Console.WriteLine(b);
}
您还需要一个
}
代码结尾

编辑:实际上您可以使用
。比如,

if ((b > a) && (b > c));
平等

if ((b > a) && (b > c))
{

}
查看if语句后分号不正确的原因。在
if((b>a)和&(b>c)行中,
不需要
(b>a)
。你已经知道
a
不是最大的,你只关心
b
c
if ((b > a) && (b > c))
{

}