问题补充:
C#怎么比较三个数的大小并按从大到小的顺序输出?要用if语句.
答案:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{ class Program
{ static void Main(string[] args)
{ Console.WriteLine(请输入三个数:);
double a = Convert.ToDouble (Console .ReadLine ());
double b = Convert.ToDouble(Console.ReadLine());
double c = Convert.ToDouble(Console.ReadLine());
double ? max=null ;
double ? middle =null ;
double ? min=null ;
if (a >= b && b >= c) {max = a;
middle = b;
min = c;
} elseif(a>=c&&c>=b){ max = a;
middle = c;
min = b;
}else if (b >= a && a >= c) { max = b;
middle = a;
min = c;
} elseif (b >= c && c >= a) { max = b;
middle = c;
min = a;
} else if (c>= a && a >= b) { max = c;
middle = a;
min = b;
}