Answer to Question #265182 in C++ for ursula

Question #265182

What will the value of the solution variable be after the code segment below has been run.


int solution = 8; 

int number1 = 16, number10 = 3; 

 

solution *= number1 - number10 ;  



1
Expert's answer
2021-11-21T17:34:37-0500
#include<iostream>
using namespace std;

int main()
{
	int solution = 8;
	int number1 = 16, number10 = 3;
	solution *= number1 - number10;
	//Priority of operation "-" more high than "*=" therefore
	//firstly calculated number1 - number10 = 16 - 3 = 13 then
	//solution *= 13 = 8 * 13 = 104
	cout << "Solution= " << solution;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS