Question: Write a program to convert a number from decimal notation to a number expressed in a number system whose base ( or radix ) is

Write a program to convert a number from decimal notation to a number expressed in a number
system whose base (or radix) is a number between 2 and 16. The conversion is performed by
repetitious division by the base to which a number is being converted and then taking the
remainders of division in the reverse order using a stack. For example, in converting to binary,
number 6 requires three such divisions: 62=3 remainder 0,32=1 remainder 1, and finally, 12=
0 remainder 1. The remainders 0,1, and 1 are put in the reverse order so that the binary equivalent
of 6 is equal to 110.
Number systems with bases greater than 10 require more symbols. Therefore, use capital letters.
For example, a hexadecimal system requires 16 digits: 0,1,dots,9,A,B,C,D,E,F. In this system,
decimal number 26 is equal to 1A in hexadecimal notation, because 2616=1 remainder 10(that is,
A), and 116=0 remainder 1.
 Write a program to convert a number from decimal notation to

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!