1. 程式人生 > >c#輸入三個數,打印出中間的數值

c#輸入三個數,打印出中間的數值

Console.WriteLine("請輸入三個數:");

int a = int.Parse(Console.WriteLine());

int b = int.Parse(Console.WriteLine());

int c = int.Parse(Console.WriteLine());

int max = a>b?a:b;

max=max>c?:max:c;

int min = a<b?a:b;

min= min<c?min:c;

int sum = a+b+c;

int mid = sum-max-min;

Console.WriteLine(mid);