-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFun11.java
More file actions
35 lines (27 loc) · 579 Bytes
/
Fun11.java
File metadata and controls
35 lines (27 loc) · 579 Bytes
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
package fun;
/**
* Project Admin -> Husanboy Azamov
* Package Name -> fun
* Class Date -> 6/21/2022/ 2:03 PM
*/
public class Fun11 {
static int a, b;
public static void main(String[] args) {
a = 8;
b = 7;
show();
sort2();
show(); // 7, 8
}
public static void sort2() {
if (a > b) swap();
}
public static void swap() {
a = a + b; // a = 15
b = a - b; // b = 7
a = a - b; // a = 8
}
public static void show() {
System.out.printf("%d, %d\n", a, b);
}
}