-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayQ1.java
More file actions
31 lines (21 loc) · 858 Bytes
/
ArrayQ1.java
File metadata and controls
31 lines (21 loc) · 858 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
// Create an integer array , get input for 5 number and print their sum or total
import java.util.Scanner;
class ArrayQ1 {
public static void main(String[] args) {
int[] Score = new int[5];
Scanner scan = new Scanner(System.in);
System.out.println("Enter Score 1");
Score[0] = scan.nextInt();
System.out.println("Enter Score 2");
Score[1] = scan.nextInt();
System.out.println("Enter Score 3");
Score[2] = scan.nextInt();
System.out.println("Enter Score 4");
Score[3] = scan.nextInt();
System.out.println("Enter Score 5");
Score[4] = scan.nextInt();
System.out.println();
System.out.println("Total Score :-");
System.out.println(+Score[0]+Score[1]+Score[2]+Score[3]+Score[4]);
}
}