Write a C program that will ask the user to enter a decimal number. It will then use an integer array to store the values of the remainders after repeatedly dividing the user’s input by 2. Finally,...


Write a C program that will ask the user to enter a decimal number. It will then use an integer array to store the values of the remainders after repeatedly dividing the user’s input by 2. Finally, the array values representing the binary equivalent will be printed out to the user.


You should have two loops in your program:


1.a while or do-while loop to repeatedly divide the number and store the remainders in the array


2. a for loop to print the values of the array


Don’t forget to break the program into smaller steps and compile and run AFTER EACH STEP


XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx


Sample output of three separate runs is show below with user input in bold:


> ./a.out


Enter a decimal number:
23


The binary equivalent of 23 is 10111


> ./a.out


Enter a decimal number:
729


The binary equivalent of 729 is 1011011001



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here