Explanatory Question
What will be the output of the following program segment?
int ar[] = {1, 2, 3, 4, 5};
int a = 1;
for (int i = 0; i < 7; i++) {
a = a + i * ar[i];
}
System.out.println(a);
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.