Last Updated : 14 Feb, 2019

What will be the output of the following program?

#include <stdio.h>

int main() 
{
    int n = 10,a = 5;

    a += n;

    printf(\"%d\",a);

    return 0;
}

(A) 5
(B) 10
(C) 15
(D) Garbage Value


Answer: (C)

Explanation: a += n is equivalent to a = a + n.
Therefore a = 5 + 10 = 15

Quiz of this Question


Share your thoughts in the comments