-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask5.java
More file actions
30 lines (23 loc) · 865 Bytes
/
Task5.java
File metadata and controls
30 lines (23 loc) · 865 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
import java.util.Arrays;
import static utils.LineSeparator.*;
public class Task5 {
private static int SUM = 0;
private static int MULTIPLICATION = 1;
public static void main(String[] args) {
System.out.print("Your digits: " + Arrays.toString(args) + ";" + lineSeparator());
counterSum(args);
counterMultiplication(args);
System.out.println("Result sum: " + SUM + ";");
System.out.println("Result multiplication: " + MULTIPLICATION + ";");
}
private static void counterSum(String[] args) {
for (String stringArgForSum : args) {
SUM += Integer.parseInt(stringArgForSum);
}
}
private static void counterMultiplication(String[] args) {
for (String stringArgForMul : args) {
MULTIPLICATION *= Integer.parseInt(stringArgForMul);
}
}
}