Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can anybody help me build the code that will do what this assignment asks? 1. Convert the given numbers to the other bases. The data
Can anybody help me build the code that will do what this assignment asks?
1. Convert the given numbers to the other bases. The data values are small enough to be shown in 8 bit binary. They can be positive or negative. Binary Number 0001 0010 1000 0000 Hexa-Decimal 12 80 Equivalent in base 10 18 0001 0111 1000 0001 1100 0011 12 100 20 75 AB 2. Write a C program to do the following tasks: a) Declare an int variable, name it number. b) Prompt the user to enter a whole number - read it into the variable. a. Validate the range in a loop. Valid range is 20 to 200 both inclusive c) Display the number to the screen (base 10) d) Display the number in hexadecimal (Use %X) c) Determine the rightmost bit in the number, display it to the screen (0 or 1) 0000 0001 Do a bitwise &between the number and the maskRight, If it is equal to 0, the rightmost bit is 0, otherwise, it is 1 o f) Create a mask to determine the fifth bit from the right in the number 0001 0000 o Do a bitwise&between the number and the mask - if it is equal to 0 the 5th bit in number is 0, otherwise it is 1 g) Shift the number to the left by 2 bits - display the updated number to the screen (It will be multiplied by 2 twice).I Enter a whole numbernetueen 20 and 200, inclusive: 210 Enter a whole number netueen 20 and 200, inclusive: 17 Enter a whole nunber netueen 20 and 200, inclusive: 35 The input number is: 35 The number in Hexadecimal: 23 The right most bit is 1 The fifth bit is Number after 2 bits shift to the left140Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started