-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayExample.java
More file actions
23 lines (19 loc) · 566 Bytes
/
ArrayExample.java
File metadata and controls
23 lines (19 loc) · 566 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.util.*;
public class ArrayExample{
public static void main(String... args){
int [] scores = new int[10];
Scanner input = new Scanner(System.in);
for (int count = 0; count < 10; count++){
System.out.println("Enter score: ");
scores[count] = input.nextInt();
}
System.out.printf("%s%10s%n", "index", "score");
for (int count = 0; count < 10; count++){
System.out.printf("%5d%10d%n", count, scores[count]);
}
System.out.print("Score: ");
for (int count = 0; count < 10; count++){
System.out.printf("%3d%c", scores[count], ',');
}
}
}