using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ts01{ class Program { //計算三個整數的最大值 static int Max3(int a, int b, int c) { int maxValue = a; if(maxValue < b) { maxValue = b; } if(maxValue < c) { maxValue = c; } return maxValue; } //計算三個整數的最小值 static int Min3(int a, int b, int c) { int minValue = a; minValue = Math.Min(minValue, b); minValue = Math.Min(minValue, c); return minValue; } static void Main(string[] args) { int a = 10, b = 20, c = 30; Console.WriteLine("10, 20, 30 "s max value is:{0}", Max3(a, b, c)); Console.WriteLine("10, 20, 30 "s min value is:{0}", Min3(a, b, c)); } }}
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ts01{ class Program { //計算三個整數的最大值 static int Max3(int a, int b, int c) { int maxValue = a; if(maxValue < b) { maxValue = b; } if(maxValue < c) { maxValue = c; } return maxValue; } //計算三個整數的最小值 static int Min3(int a, int b, int c) { int minValue = a; minValue = Math.Min(minValue, b); minValue = Math.Min(minValue, c); return minValue; } static void Main(string[] args) { int a = 10, b = 20, c = 30; Console.WriteLine("10, 20, 30 "s max value is:{0}", Max3(a, b, c)); Console.WriteLine("10, 20, 30 "s min value is:{0}", Min3(a, b, c)); } }}