Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CNIT 105 In Lab10 Due: By the end of your lab session OBJECTIVES: bitwise operations main () function: 1. Declare an int variable, name it

image text in transcribed
image text in transcribed
CNIT 105 In Lab10 Due: By the end of your lab session OBJECTIVES: bitwise operations main () function: 1. Declare an int variable, name it number. 2. Prompt the user to enter a whole number- read it into the variable. Validate the range in a loop. Valid range is 20 to 200 both inclusive . 3. Display the number to the screen (base 10) 4, Display the number in hexadecimal (Use %X) 5. Display number to the screen -It will be a negative number. 6. Determine the rightmost bit in the number, display it to the screen (O or l): int maskRight-11 0000 0001 Do a bitwise & between the mamber and the maskRight If it is equal to 0, the rightmost bit is 0, otherwise, it is 1 7. Determine the third bit from the right in the number int mask3rd- 10? // 0000 0100 Do a bitwise & between the number and mask3rd-if it is equal to 0 the 3rd bit in the number is 0, otherwise it is 1. Shift the number to the left by 2 bits - display the updated number to the screen (It will be multiplied by 2 twice). 8. 9. Shifthe updated number to the right 3 bits -display the outcome to the screen. 10. Add the rerun loop to the program - allowing the user rerun the program with different input numbers. (Hint: do-while loop)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions

Question

L04 Compare the structural and functional types of neurons.

Answered: 1 week ago

Question

Question 1 (a2) What is the reaction force Dx in [N]?

Answered: 1 week ago