Skip to content

Commit 8934526

Browse files
committed
add IntegerArraySum.java
1 parent dde7a46 commit 8934526

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Diff for: src/IntegerArraySum.java

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
public class IntegerArraySum {
2+
3+
public static void main(String[] args) {
4+
5+
int[] array = { 10, 20, 30 };
6+
7+
int sum = 0;
8+
9+
for (int i : array)
10+
sum += i;
11+
12+
System.out.print("sum of the given array { ");
13+
System.out.print(array[0]);
14+
System.out.print(", ");
15+
System.out.print(array[1]);
16+
System.out.print(", ");
17+
System.out.print(array[2]);
18+
System.out.print(", ");
19+
System.out.print("} is ");
20+
System.out.println(sum);
21+
22+
}
23+
}

0 commit comments

Comments
 (0)