Question: This is programming in C In your program, perform the following steps, compiling and running AFTER EACH STEP. (NOTE: use for loops for all the

This is programming in C This is programming in C In your program, perform the following

In your program, perform the following steps, compiling and running AFTER EACH STEP. (NOTE: use for loops for all the loops in your program.) 1. Prompt the user to enter a binary number. You may assume that the user will enter a number that consists only of l's and O's. 2. Store this input as a string. (compile and run) 3. Determine the length of the string so that you can declare another array to hold the integer values of each digit. (Remember, that you have to specify a size when declaring an array.) Print the number of digits (length of the string). (compile and run) 4. Use a for loop to go through the input array character by character and store the integer value of each in the integer array. 5. Use a for loop to print out the integer array to the user. (compile and run) 6. Use another for loop to convert the binary number entered by the user to a decimal value by using each integer in the integer array. (Remember how to convert binary to decimal on paper? Hint: You need to use the pow() function from the math library.) 7. Print the decimal value to the user. (compile and run) Sample output is show below: > a.out Enter a binary number consists of only ls and Os): 110101101 Your binary number consists of 9 digits The binary number you entered was: 110101101 this comes from a for loop with the integer array The decimal equivalent of that number is: 429

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!