Correct Answer : A
Execution of program starts from main
. Inside main
are 3 integer variables called n
, sum
, count
are declared and are initialized to 0
, 0
, 10
respectively. The next statement is a while
loop with condition n <= 6
. As long as this condition is satisfied while
loop is executed.
Inside while
loop, sum is added to n
and count
is decremented everytime. When count
reaches 6
, if
condition is satisfied and the loop breaks. The value of n
in program is never changed, so it is always 0
. Thus sum
will also be always zero.