码迷,mamicode.com
首页 > Windows程序 > 详细

C#笔记 三月三号 比较三个数字的大小

时间:2015-03-03 23:26:45      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:

 1 namespace ConsoleApplication8
 2 {
 3     class Program
 4     {
 5         static void Main(string[] args)
 6         {
 7             Console.WriteLine("我可以帮你比较三个数字的大小,请输入第一个数字");
 8             int noone = Convert.ToInt32(Console.ReadLine());
 9             Console.WriteLine("请输入第二个数字");
10             int notwo = Convert.ToInt32(Console.ReadLine());
11             Console.WriteLine("请输入第三个数字");
12             int nothree = Convert.ToInt32(Console.ReadLine());
13 
14             if (noone > notwo)
15             {
16                 if (noone > nothree)
17                 {
18                     Console.WriteLine("当前最大的数字为{0}", noone);
19                 }
20                 else if (notwo < nothree)
21                 {
22                     Console.WriteLine("当前最大的数字为{0}", nothree);
23                 }
24 
25             }
26             else if (notwo > noone)
27             {
28                 if (notwo > nothree)
29                 {
30                     Console.WriteLine("当前最大的数字为{0}", notwo);
31                 }
32                 else if (nothree > noone)
33                 {
34                     Console.WriteLine("当前最大的数字为{0}", nothree);
35                 }
36             }
37             else if (nothree > noone)
38             {
39                 if (nothree > notwo)
40                 {
41                     Console.WriteLine("当前最大的数字为{0}", nothree);
42                 }
43                 else if (notwo > noone)
44                 {
45                     Console.WriteLine("当前最的的数字为{0}", notwo);
46                 }
47             }
48             Console.ReadKey();
49         }
50     }
51 }

 

C#笔记 三月三号 比较三个数字的大小

标签:

原文地址:http://www.cnblogs.com/flying-coder/p/4312046.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!