Question #42581

State the order of evaluation of the operation in each of the following c++ statement and implement them to show the value of x after each statement.
X=7+3*6/2-1;
X=2%2+2*2-2/2;
X=(3*9*(3+(9*3/(3))));

Expert's answer

#include <iostream>using namespace std;int main () {   int X = 0;   X = 7 + 3 * 6 / 2 - 1;   cout << "X = 7+3*6/2-1 = " << X << endl;   X = 2 % 2 + 2 * 2 - 2 / 2;   cout << "X = 2%2+2*2-2/2 = " << X << endl;   X=(3*9*(3+(9*3/(3))));   cout << "X = (3*9*(3+(9*3/(3)))) = " << X << endl;   return 0;}
LATEST TUTORIALS
APPROVED BY CLIENTS