Question

Part E (4)- Explain what the following code would do and also give the final value for X v1-15; v2-30; x=1 if (4*v1)> (2 vz) X-0 ; end Do not merely state the end result of the code, but describe what the entire code does.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
v1 = 15
v2 = 30
X = 1

4*v1 is 4*15 => 60
2*v2 is 2*30 => 60

so, (4*v1)>(2*v2) is false. because 60 is not greater than 60.
so, body of if block is not executed.
hence final value of X, after the code executed is 1
Answer: 1 
Add a comment
Know the answer?
Add Answer to:
Part E (4)- Explain what the following code would do and also give the final value...
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