Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Algorithms Quiz | SP2 Contest 1 | Question 7

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Predict the output of the below C program:




#include <stdio.h>
  
int main() 
{
    int a = 5, b, c = 15, d = 13;
      
    b = (a = c, c += a, d = a + c + d);
      
    printf("%d %d %d %d", a,c,b,d);
      
    return 0;
}


(A) 5 30 0 58
(B) 15 30 58 58
(C) 15 30 0 58
(D) 5 30 58 33


Answer: (B)

Explanation: The variable b is assigned the value of the rightmost expression that is (d = a+b+c) = 58.

Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Last Updated : 28 Aug, 2018
Like Article
Save Article
Similar Reads