Open In App
Related Articles

Algorithms Quiz | SP2 Contest 1 | Question 7

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
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

Last Updated : 28 Aug, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads