Question

1. Given the code snippet below, what is the value of c that is printed? int...

1. Given the code snippet below, what is the value of c that is printed?

int a = 3, b = 4, c;

a = 3; b = 4;
a *= b;
c = ++a * b--;
cout << "c is: " << c ;

Answer choices: 52, 32, 42

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Ans: C is 52 (Option 1)

Explanation: a*=b means a=a*b = a=3*4 = 12

now, c= ++a*b--

since ++a means pre-increment so a's value is first incremented then multiplication occurs, so a becomes 13, b=4. As b-- is there which means post-decrement means after the operation will be performed then b's value will be reduced, hence 13*4= 52

So output value of c is 52.

Add a comment
Know the answer?
Add Answer to:
1. Given the code snippet below, what is the value of c that is printed? int...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT