PROGRAMMING AND PROBLEM SOLVING THROUGH ‘C’ LANGUAGE

1.4 What is the value of ‘average’ after the following program is executed?
main()
{
int sum, index;
float average;
sum = 0;
for( ; ; ) {
sum = sum + index;
++ index;
if (sum > = 100) break;
}
average = sum / index;
}
A) 91/13
B) 91/14
C) 105/14
D) 105/15

Leave a Reply