/*
* Created by SharpDevelop.
* User: Administrator
* Date: 2011-7-11
* Time: 11:54
* 12.输入3个数,按照从小到大的顺序输出。
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
namespace test13
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
// TODO: Implement Functionality Here
Console.Write("Please input the one number: ");
double num1 = double.Parse(Console.ReadLine());
Console.WriteLine("Please input the second number: ");
double num2 = double.Parse(Console.ReadLine());
Console.WriteLine("Please input the third number: ");
double num3 = double.Parse(Console.ReadLine());
double num, one, second , third;
one = num1;
second = num2;
third = num3;
if (num1>num2)
{
num = num1;
num1 = num2;
num2 = num;
}
// now num1<num2
if (num3<num1)
{
one = num3;
second = num1;
third = num2;
}
if (num3>num1&num3<num2)
{
one = num1;
second = num3;
third = num2;
}
if (num3>num2)
{
one = num1;
second = num2;
third = num3;
}
Console.WriteLine("{0},{1},{2}",one,second,third);
//one is first
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
}
}
12.输入3个数,按照从小到大的顺序输出。
最新推荐文章于 2024-01-04 21:58:50 发布