- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmethods_1.java
More file actions
Latest commit
38 lines (27 loc) · 733 Bytes
/
Copy pathmethods_1.java
File metadata and controls
38 lines (27 loc) · 733 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
35
36
37
38
importjava.util.Scanner;
//just we have to make a function
//so we can use this multiple times
publicclassmethods_1 {
staticintsum(intx, inty) {
intz;
if (x > y) {
z = x - y;
} else {
z = (y - x) * 5;
}
returnz;
}
publicstaticvoidmain(String[] args) {
intc;
System.out.println(" enter the value of a & b");
Scannersc = newScanner(System.in);
inta = sc.nextInt();
intb = sc.nextInt();
c = sum(a, b);
inta1 = 8;
inta2 = 4;
intc1 = sum(a1, a2);
System.out.println(c,);
System.out.println(c1);
}
}