-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathExerciseTwo.java
More file actions
34 lines (27 loc) · 909 Bytes
/
ExerciseTwo.java
File metadata and controls
34 lines (27 loc) · 909 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 Online_Code_Samples.Week2;
import java.util.Scanner;
public class ExerciseTwo {
public static void main(String[] args) {
int[] arrayTotal = new int[4];
for( int i = 0; i < arrayTotal.length; i++ ){
int total = 0;
int count = 1;
Scanner scanner = new Scanner(System.in);
do{
System.out.print("Please enter an integer: ");
int entry = scanner.nextInt();
total += entry;
if( (count) % 5 == 0){
arrayTotal[i] = total;
}
count++;
} while( count <= 5 );
}
int total = 0, count = 1;
for( int x : arrayTotal ){
System.out.println("Series " + count++ + " total = " + x);
total += x;
}
System.out.println("Total Summation = " + total);
}
}