Evaluate the following expressions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Evaluate the following expressions

a=7 b=5 a%=3 z=(a>b)?a:b z=(b=2)+a++ - - a y=pow(a, 2)+sqrt(b*b) Please help guyz .Anyone online help this is urgent

1st Aug 2019, 2:34 PM
Promise Ncube
Promise Ncube - avatar
2 Answers
+ 2
a%=3 sets a = 1 z=(1>5) sets z = 5 z=(5=2)+a++ = sets b to 2, then adds to it the value of a, ignoring the ++, the ++ will add the value in the next statement of the code. if it was ++a the value would change immediately. then you minus negative a, double negative makes it into + a, the ++ now changes the value of a making z = (b=2) + a++ (b now equals 3) - -a(the ++ now comes into affect and b = 5) Lastly, y = pow(2, 2) = 4 + sqrt(2*2) = 2 4+2 = 6
1st Aug 2019, 2:54 PM
Ole113
Ole113 - avatar
+ 1
Thanx
1st Aug 2019, 2:57 PM
Promise Ncube
Promise Ncube - avatar