ry
{
double min = 0;
double[] jiage = new double[4];
Console.WriteLine("请输入四家店的价格");
for (int i = 0; i < 1; i++)
{
Console.Write("请输入第{0}的价格:",i+1);
jiage[i] = Convert.ToDouble(Console.ReadLine());
min = jiage[i];
}
for (int i = 1; i < jiage.Length; i++)
{
Console.Write("请输入第{0}的价格:",i+1);
jiage[i] = Convert.ToDouble(Console.ReadLine());
if (jiage[i]< min)
{
min = jiage[i];
}
}
Console.WriteLine("最低的价格为{0}",min);
}
catch
{
Console.WriteLine("输入有误");
}
Console.ReadKey();
网友评论