a=22, b=12,c a= a*3%b; c=a++ + ++a; b=(a+c>14)?12:14;​

Answers 1

Answer: b will be assigned with the value 12

Explanation:

Here, in the given code, three variables are taken which are a, b and c.

a and b are initialized with the value 22 and 12 respectively.

Second line basically assigns a new value to a on the basis of the given equation.

The operation will go from left to right where '%' is the modulus operator.

Therefore,

[tex]a * 3 = 66\\[/tex]

a = 66 modulo b = 6

Now, accordingly, c = 14

Now, the last part contains the ternary operator which is a conditional operator. It is also used as an alternative for if-else statement as well.

If the given equation in the parenthesis is true, then b will be assigned with the value 12 and if the equation returns false then b will be assigned with the value 14.

Here,

[tex]a + c = 6 + 14 = 20[/tex]

Since, 20 is greater than 14 and hence the statement in the parenthesis is true.

Therefore, b = 12

Please check the code in the attachment.

answer img

If you know the answer add it here!

Can't find the answer?

Log in with Google

or

Forgot your password?

I don't have an account, and I want to Register

Choose a language and a region
How much to ban the user?
1 hour 1 day 100 years