Question: C program, please include comments. Thank you! Write a program that: 1) Asks the user to input a non-negative integer value in base 10. 2)

 C program, please include comments. Thank you! Write a program that:1) Asks the user to input a non-negative integer value in base10. 2) Asks the user to input a base to which the

C program, please include comments. Thank you!

Write a program that: 1) Asks the user to input a non-negative integer value in base 10. 2) Asks the user to input a base to which the base 10 value should be converted. The user should be able to request bases 2, 3, 4, 8, or 16. 3) Uses the Quotient/Remainder method to perform the conversion. No other method is acceptable. 4) Print out the base 10 number and the number in the requested base. Note that for Hex you must obviously use A, B, C, D, E, and F for 10, 11, 12, 13, 14, and 15 respectively. 5) Continues this loop until the user enters a -1 as the base 10 value. Quotient Remainder Method for Converting From Base 10 Uses integer division, which separates the quotient and the remainder. Example: 10/4 = 2 rem 2. 23/5 = 4 rem 3. Approach is to repeatedly divide the number in base 10 by the base to convert to until quotient is 0. The number in the new base is the collection of remainders in order, where the first remainder is the least significant bit (i.e., goes in the Base^0 position). Example: Convert 164 base 10 into base 8. Quotient Remainder 164/8 = LSD 20/8 = 2/8 2/8 = 2 4 4 MSD

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!