[Solved] Code does not output expected value; how to modify it to obtain the expected result? [closed]


Use braces for complex operations.

Also, you should remember BODMAS Rule:
Bracket Of Divide Multiply Addition Subtraction

int ans=(42+45-48-5-15+20)*2;

0

solved Code does not output expected value; how to modify it to obtain the expected result? [closed]