Algorithms Quiz | SP2 Contest 1 | Question 7
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
Please Login to comment...