C#--求三個數的最大數

iamzxf發表於2015-03-24
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace four
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;
            int maxNumber;

            if (int.TryParse(Console.ReadLine(), out a) && int.TryParse(Console.ReadLine(), out b) && int.TryParse(Console.ReadLine(), out c))
            {
                maxNumber = (a > b ? a : b) > c ? (a > b ? a : b) : c;
                Console.WriteLine(maxNumber);
            }
            else
                Console.WriteLine("input erro");

            Console.ReadLine();

        }
    }
}

相關文章