Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

i need help solving this problem in c++ wihtout changing the operators and value just put the brackets in the right place

i need to solve this problem wihtout changing anything just put brackets to get the answer 10000

need the output using brackets only wihtout changing anything to be 10000

#include <iostream>
using namespace std;
int main()
{
int a = 10;
int b = 20;

cout << a + b * a + b + a * a * a << "\n";       // 10000

} 

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

((10 + 20) * (10 + 20) + (10 * 10)) * 10 This will provide you with the answer. Look at operator precedence in C++ and THE BODMAS rule .

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading