-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPractice15.java
47 lines (42 loc) · 1.01 KB
/
Practice15.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package fiftypratice;
import java.util.Scanner;
/**
* 题目:输入三个整数x,y,z,请把这三个数由小到大输出。
* */
public class Practice15 {
public static void main(String[] args) {
int x,y,z;
//int min,mid,max;
System.out.println("请输入三个整数:");
Scanner s=new Scanner(System.in);
x=s.nextInt();
y=s.nextInt();
z=s.nextInt();
if(s!=null){
s.close();
}
//min=x;
if(x>y){
int temp;
temp=x;
x=y;
y=temp;
}
if(x>z){
int temp;
temp=x;
x=z;
z=temp;
}
if(y>z){
int temp;
temp=z;
z=y;
y=temp;
}
System.out.println("从小到大依次为:");
System.out.print(x+" ");
System.out.print(y+" ");
System.out.print(z);
}
}