Question: please help me! Code miste be written in C language, also if you could write a little report would be great!! thank you, ill guve

please help me! Code
miste be written in C language, also if you could write a little report would be great!! thank you, ill guve thumb up  please help me! Code miste be written in C language, also
if you could write a little report would be great!! thank you,
ill guve thumb up THE BASIC CODE I have provided you with
a basic code in main.c. This code takes a 16-digit (or 16
bits) binary number from the user and stores it in a string
Then it takes the first characters (bits) in the string and converts

THE BASIC CODE I have provided you with a basic code in main.c. This code takes a 16-digit (or 16 bits) binary number from the user and stores it in a string Then it takes the first characters (bits) in the string and converts them to a character representing their value in hexadecimal Then it saves the hexadecimal value as the first character in a string that then gets printed to the screen In this entire process, the code also times the execution time of the conversion, using functions from the time he library (You do not need to change the timing code) THE CHALLENGE As you can see the basic code only processes the first 4 bits of the full 16-bit binary number Your first objective is to complete the code that translates the full 16-bit binary number to a 4-digit hexadecimal number One major acvantage is that every 4 bits can easily be converted to hexadecimal so you can easily repurpose the existing code into something that can actually process the whole 16-bits create tho 4-digit hexadecimal number and store it in the output hex string array Interestingly enough there is a ways in which you can do this 1. Without loops Just copy and paste the code that exists making sure you update the indices for both turbinary and output how 2. With a single loop Simply put the code that exist inside a loop that runs 4 times changing the indices in the existing code so they change based on the loop number (I'll leave the specifics to you) 3. With multiple single loops Have you noticed that the existing code looks a little repetitive? You can actually replace a good chunk of it with a loop that processes A bits into a decimal value And you can copy paste this loop 4 times, one per each section of 4 binary digits, to create the Hexadecimal number 4. With nested loops. A combination of 2 and 3, with an outer loop that runs 4 times (one per each hexadecimal digit), and a loop that runs times (once per each binary digit in a block of 4 that can be converted into a hexadecimal value) For this coding challenge you will need to program all of these different ways, one at a time 60 lines (44 sloc) 1.42 KB 2 3 include #include // To measure time. #include // Used for pow() 5 int main(void) { > S 1/ start and end used to measure execution time clock_t start, end; 9 10 1 char input_binary[17]; char output_hex[5); scanf("%s", input_binary); // Get the time before running conversion clock(); start - 15 16 12 15 19 /**** * YOUR CODE SUBMISSION STARTS HERE * Feel free to modify the existing code. * It is provided for your convenience. 20 21 22 int value; int digit: 24 25 26 27 28 29 38 32 // Convert first 4 bits to decimal value digit (int) (input_binary[3] - 'e'); value - digit * (int)pow(2, 3); = = digit (int)(input_binary[2] - '); value +- digit (int)pow(2, 2); 32 33 digit (int) (input_binary[1] - '); value - digit * (int) pow(2, 1); 35 36 137 digit (int) (input_binary[@] - **); value +- digit (int)pow(2, 0); 36 digit = (int)(input_binary[@] - 'O'); value += digit * (int)pow(2, 0); 37 38 39 40 41 // Convert decimal value to hex character if(value

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!