效果
2018-12-06第一题
代码
Console.WriteLine("请输入4家店的价格");
int[] a = new int[4];
int min = 0;
try
{
for (int i = 0; i < a.Length; i++)
{
Console.Write("第{0}店的价格:",i+1);
a[i] = Convert.ToInt32(Console.ReadLine());
if (i==0)
{
min = a[0];
}
if(min>a[i])
{
min = a[i];
}
}
Console.WriteLine("最低价格是:{0}",min);
}
catch
{
Console.WriteLine("输入格式错误");
}
Console.ReadKey();
网友评论