निम्नलिखित कोड का आउटपुट क्या होगा?
What will be the output of the following code ?
#include <stdio.h>
void solve() {
int b = 4;
int res = b++ + ++b + ++b;
printf("%d", res);
}
int main() {
solve();
return 0;
}
A
12
B
15
C
17
D
20
Explanation
The expression b++ + ++b + ++b evaluates as follows:
b++uses the value ofb(4) and increments it to 5.++bincrementsbto 6, then uses it.++bincrementsbto 7, then uses it.
So, the sum is 4 + 6 + 7 = 17.
Correct Answer:
(C) 17.
Correct Answer: C) 17