|
@@ -1,9 +1,28 @@
|
|
1
|
+import java.util.*;
|
1
|
2
|
/**
|
2
|
3
|
* Created by iyasuwatts on 10/17/17.
|
3
|
4
|
*/
|
4
|
5
|
public class Main {
|
5
|
6
|
|
6
|
7
|
public static void main(String[] args){
|
7
|
|
-
|
|
8
|
+
|
|
9
|
+ int n, sum = 0, i =0;
|
|
10
|
+ Scanner sc = new Scanner(System.in);
|
|
11
|
+ System.out.println("Enter numbers you want to sum");
|
|
12
|
+ n = sc.nextInt();
|
|
13
|
+ int a[] = new int[n];
|
|
14
|
+
|
|
15
|
+ System.out.println("Enter the " +n+ "numbers ");
|
|
16
|
+ while (i <n)
|
|
17
|
+ {
|
|
18
|
+ System.out.println("Enter number " + (i+1) +":");
|
|
19
|
+ a[i] = sc.nextInt();
|
|
20
|
+ sum += a[i];
|
|
21
|
+ i++;
|
|
22
|
+ }
|
|
23
|
+ System.out.println("sum is =" +sum);
|
8
|
24
|
}
|
9
|
25
|
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|