如何使应用程序从三个数字中获取最大数字? [英] How To Make application to get Max Number from three Number?

查看:63
本文介绍了如何使应用程序从三个数字中获取最大数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是C#的初学者我想得到您的帮助
感谢每个为我提供帮助的人.

解决方案

  let  max =  0 ;
 foreach (数字n  in 个数字)
{
    如果 n 大于或等于,则
         max = n
} 


 max = Math.Max(Math.Max(n1,n2),n3)); 


它可能对您有帮助,

 使用系统;
使用 System.Linq;

命名空间 ConsoleApplication1
{
     class 程序
    {
        静态 无效 Main(字符串 []参数)
        {
             int  [] arrayToCheck = { 100  2  3 };
            Console.WriteLine(arrayToCheck.ToArray().Max());
        }
    }
} 


:)


I''am Beginner In C# I want to have your help
Thank for every one who help Me.

解决方案

let max = 0;
foreach (number n in numbers)
{
    if n is greater than max then
        let max = n
}


max = Math.Max(Math.Max(n1, n2), n3));


It might help you,

using System;
using System.Linq;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arrayToCheck = { 100, 2, 3 };
            Console.WriteLine(arrayToCheck.ToArray().Max());
        }
    }
}


:)


这篇关于如何使应用程序从三个数字中获取最大数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆