Computer Science, asked by Sumitop, 11 months ago

Give the output when x=15
x+= x++ + --x + --x + x++​

Answers

Answered by ridhimakh1219
1

The value of x is 73, x = 73

Explanation:

C++ program to evaluate expression x+= x++ + --x + --x + x++​

#include <iostream>

using namespace std;

int main()

{

   int x = 15;

   x+= x++ + --x + --x + x++;

   cout << "x = " << x;

   return 0;

}

Output

x = 73

Note

Given expression, x+= x++ + --x + --x + x++      ..................... 1)

Let us suppose,

a =  x++ + --x + --x + x++

eq. 1) becomes x+= a   ...............  2)

Evaluate a = x++ + --x + --x + x++ where x = 15

a = 15 + 14 + 14 + 15

a = 58

put value of a in eq. 2)

x+= 58 means x = x + 58

x = 15 + 58 = 73

x = 73

Similar questions