Computer Science, asked by MrTSR, 2 months ago

Level: Easy
Explain the working of the following códe with output.

#include
int main()
{
int d, a = 1, b = 2;
d = a++ + ++b;
printf("%d %d %d", d, a, b);
}

Answers

Answered by anindyaadhikari13
5

Correct Códe:

#include <stdio.h>

int main() {

int d, a = 1, b = 2;

d = a++ + ++b;

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

return 0;

}

Output:

4 2 3

Explanation:

Initially,

→ a = 1 and,

→ b = 2

After evaluation,

→ d = a++ + ++b

→ d = 1 + ++b (a = 1, post-increment)

→ d = 1 + ++b (a becomes 2)

→ d = 1 + 3 (b = 3, pre-increment)

So,

→ d = 4

→ a = 2

→ b = 3

Now, values of d, a and b are displayed on the screen.

>> Output: 4 2 3

•••♪

Answered by XxItzAdyashaxX
0

Answer:

include "stdio.h"

int main()

{

int x, y = 5, z = 5;

x = y == z;

printf("%d", x);

getchar();

return 0;

}

Similar questions