A short value is stored in 16 bits. Write a program that prompts the user to enter
Question:
A short value is stored in 16 bits. Write a program that prompts the user to enter a short integer and displays the 16 bits for the integer. Here are sample runs:
Enter an integer: 5
The bits are 0000000000000101
Enter an integer: –5
The bits are 1111111111111011
(Hint: You need to use the bitwise right shift operator (>>) and the bitwise AND operator (&), which are covered in Appendix G, Bitwise Operations.)
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Introduction To Java Programming And Data Structures Comprehensive Version
ISBN: 9780136520238
12th Edition
Authors: Y. Daniel Liang
Question Posted: