Math, asked by Sushamadeysil, 4 months ago

int h[ ] = {6, 12, 18, 24, 30, 42};

int sum = 0;

for (int k=0; k<6; k++)

sum + = h[k];

System.out.print(sum):​

Answers

Answered by IdrisLokhande
0

Answer:

Sum = 132

Step-by-step explanation:

With each iteration in the for-loop, each element in the array gets added to the pervious value of sum.

Like this:

1st iteration: sum = 0+6 (6 is the first element of array h

2nd iteration: sum = 6+12 (12 is the second element of array h)

And this goes on till k = 5 (when it reaches till the last element of the array)

Similar questions