Question
Above is the must-be format for the code. Please, do not change int main() part. Part 1. Solve the following 4 problems manually and write
Above is the must-be format for the code. Please, do not change int main() part.
Part 1.
Solve the following 4 problems manually and write the solutions in the corresponding comment at the beginning of file hw2.c: 1. Convert 0x9DC7B3F2 from hex to binary. 2. Convert 01110011 01011101 10110100 01101010 from binary to hex. 3. Convert 0x0000F3 from hex to decimal notation. 4. Convert 11100101 from binary to decimal notation.
Part 2.
Implement function hex2dec that takes a hexadecimal number hex_num as a string argument and prints out the corresponding decimal number. Each char in the string represents a hex digit including '0', '1,', ..., '9', 'A', 'B', ..., 'F'. The string does not have any leading space. For example, function call hex2dec("A8EC") should print 43244. You can assume that hex_num can have up to 8 hex digits. Restriction: printf is the ONLY C library function that you can use in the implementation.
Part 3.
Implement function dec2hex that takes an int argument num and prints out the corresponding hexadecimal number. For example, function call dec2hex(235) should print EB. Restriction: printf is the ONLY C library function that you can use in the implementation and you should NOT use the "%x", "%X", "%o", "%a", "%A" or any number conversion format specifiers.
Step 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