CS 122 - Computer Science II
Assignment 3
Binary To Hex Number Conversion and Output

Write a a program that will input a number and then convert the number to hexadecimal (base 16) and print it out. You should use a loop to calculate the hexadecimal digits by dividing by 16 and getting the remainder which is the value of the digit. Convert the digit to a character and store it in an array. When the quotient reaches zero, you have all the digits. The digits will be in the array in reverse order and must be copied to another array in the reverse order. Add a null character to the array and print the string.

After converting a number and printing it out, ask the user if they want to convert another number.

SAMPLE EXECUTION:


WHAT NUMBER DO YOU WANT TO CONVERT ?  1722 

THE HEXADECIMAL VALUE OF THAT NUMBER IS: 6BA

DO YOU WANT TO CONVERT ANOTHER NUMBER (Y OR N) ?  Y 
WHAT NUMBER DO YOU WANT TO CONVERT ?  5126 

THE HEXADECIMAL VALUE OF THAT NUMBER IS: 1406


DO YOU WANT TO CONVERT ANOTHER NUMBER (Y OR N) ?  N