Skip to content

Commit bff2ec1

Browse files
author
codehouseindia
authored
Merge pull request codehouseindia#125 from KshitizKhandal/patch-1
Sum of Array
2 parents fa31b9f + 53fed08 commit bff2ec1

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Sum of array

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class SumOfArray{
2+
public static void main(String args[]){
3+
int[] array = {10, 20, 30, 40, 50, 10};
4+
int sum = 0;
5+
//Advanced for loop
6+
for( int num : array) {
7+
sum = sum+num;
8+
}
9+
System.out.println("Sum of array elements is:"+sum);
10+
}
11+
}

0 commit comments

Comments
 (0)