import java.util.Scanner; public class A04 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); double[] Price = new double[4]; double min = 0; System.out.println("请输入4家店的价格"); for (int i = 0; i < Price.length; i++) { System.out.print("第" + (i + 1) + "店的价格:"); Price[i] = input.nextDouble(); } min = Price[0]; for (int i = 0; i < Price.length; i++) { if (Price[i] > min) { Price[i] = min; } } System.out.println("最 低 价 格 是:" + min); } }
java-第七章-数组-求出一些数的最小值,布布扣,bubuko.com
原文地址:http://wenwen520.blog.51cto.com/8956560/1420974