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 ;
#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;
}
Comments
Leave a comment