import java.util.Scanner;
public class Shuju3{
public static void main(String[] args) {
int[] money = new int[4];
Scanner input = new Scanner(System.in);
System.out.println("请输入4家店的价格:");
for (int i=0;i<money.length;i++) {
System.out.print("请输入第" +(i+1)+"家店的价格:");
money[i] = input.nextInt();
}int min=0;
min = money[0];
for (int i=0;i<money.length;i++) {
if(min>money[i]) {
min = money[i];
}
}System.out.println("最低价格是:" +min);//单位(元)
}
}
第七章数组
最新推荐文章于 2021-12-08 17:01:57 发布