-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDay19_prob1.java
More file actions
45 lines (33 loc) · 949 Bytes
/
Day19_prob1.java
File metadata and controls
45 lines (33 loc) · 949 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
39
40
41
42
43
44
45
/*
write a program that creates integer array of n elements, accepts the values of arrays and find sum of elements as an integer.
Input Format
Accepts n values from the user.
Constraints
All number should be integer values (Positive, negative and zero)
Output Format
diplays the sum of the array's elements as a single integer.
Sample Input 0
5
3 4 10 11 20
Sample Output 0
48
*/
// kirtan jain
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(), sum = 0;
int[] a = new int[n];
for(int i=0;i<n;i++){
a[i]=sc.nextInt();
sum+=a[i];
}
System.out.println(sum);
}
}