Question help!

1. Find the Value of X.

a = 12; b=4; c=2; d=10; e=3;

x = (a + d % e + e)/b % 3;

2. Write a c++ statement equivalent to the following mathematical assignment

x= a2+b3/(a+b*c)

These are just practice test questions, I want to see how you guys can solve it so I can see I'm doing it right, thank you so much!!

1. If all variables are integer type then ,
value of X become 1.

2. x= a2+b3/(a+b*c) - and this is valid c== statement.
i.e. no need to convert in any form you can use same.

I think you are facing problem in simplifying the statements.
For this you should know the operator precedence.
following link will clear you more.

http://en.cppreference.com/w/cpp/language/operator_precedence
Topic archived. No new replies allowed.