int x=5, y=-10, z=9; int c=-8; c+=x++ + 5 + --y/(--x + 3%2) + --z + 97; C=?
Answers
Explanation:
Prepare
Practice
Online Practice Test >c
« PreviousNext »
int z,x=5,y=-10,a=4,b=2;
z = x++ - --y * b / a;
Value of z:
Options
- 10
- 11
- 12
- 5
- 6
CORRECT ANSWER : 10
Discussion Board
RULE
why aren''t we following BODMAS rule
PRAVIN 08-31-2018 01:30 AM
increment and decrement
This platform is very useful for me. But i can''t clearly understand the discussion board explanation becoz --10 value is 9 why you should increement the value as 11.pls give a clear explanation.
udhaya 09-12-2017 06:01 AM
Correct Explanation
z= x++ - --y * b / a;
z= 5++ - (-- -10) *2/4
z= 5++ - (-11*2) /4 // decrement of -10 is -11
z= 5++ - (-22/4)
z= 5++ - (-5)
z= 5++ + 5
z= 5++ + 5
z= 10 //5++ will be incremented after operation on 5 is done
//value of x will be 6 after it assigns value of z to be 10.
Arif 11-15-2016 02:26 PM
this answer 10
this progaram is using the operaters . so operater in *,/,+,_ on alpbet order.
PRAKASH.k 11-3-2014 12:01 AM
i think
5++ - --(-10)*2/4
5++ - --(-10)*0.5 // explicitly type casting to float
5++ - (-11)*0.5
5++ - (-5.5)
5 + 5.5
10.5