Question

Exercise 14: Write a program that assigns the value 50000 to an integer variable x, assigns...

Exercise 14: Write a program that assigns the value 50000 to an integer variable x, assigns the value of x*x to an integer variable y, and then prints out the value of y. Did you get a strange answer? If so, explain why.

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

Yes, I got a strange result
x*x = 50000*50000 = 2500000000

but the maximum value an integer can store is 2147483647. so, we can't store 2500000000 inside an integer.
that's the reason for a strange answer.
Add a comment
Know the answer?
Add Answer to:
Exercise 14: Write a program that assigns the value 50000 to an integer variable x, assigns...
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