1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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);
}
}
|
本文转自 Y幕徐 51CTO博客,原文链接:http://blog.51cto.com/765133133/1420974