subject

In the programming example, converting a number from decimal to binary, given in this chapter (15), you learned how to convert a decimal number into the equivalent binary number. two more number systems, octal (base 8) and hexadecimal (base 16), are of interest to computer scientists. in fact, in c++, you can instruct the computer to store a number in octal or hexadecimal. (appendix c describes these number systems.)

the digits in the octal number system are 0, 1, 2, 3, 4, 5, 6, and 7. the digits in the hexadecimal number system are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, and f. so a in hexadecimal is 10 in decimal, b in hexadecimal is 11 in decimal, and so on.

the algorithm to convert a positive decimal number into an equivalent number in octal (or hexadecimal) is the same as discussed for binary numbers. here, we divide the decimal number by 8 (for octal) and by 16 (for hexadecimal). suppose ab represents the number a to the base b. for example, 7510 means 75 to the base 10 (that is decimal), and 8316means 83 to the base 16 ( that is hexadecimal). then 75310 = 13618 and 75310 = 2f116.

write a program that uses a recursive function to convert a number in decimal to base 8 or base 16.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:00
The most efficient way to establish top best possible economize position is to measure
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
Research data that is presented using descriptive language is said to be
Answers: 2
question
Computers and Technology, 23.06.2019 13:00
Which one of the following voltages should never be measured directly with a vom? a. 1200 v b. 500 v c. 800 v d. 100v
Answers: 2
question
Computers and Technology, 23.06.2019 18:30
Write a program that prints the day number of the year, given the date in the form month-day-year. for example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 359. the program should check for a leap year. a year is a leap year if it is divisible by 4, but not divisible by 100. for example, 1992 and 2008 are divisible by 4, but not by 100. a year that is divisible by 100 is a leap year if it is also divisible by 400. for example, 1600 and 2000 are divisible by 400. however, 1800 is not a leap year because 1800 is not divisible by 400.
Answers: 3
You know the right answer?
In the programming example, converting a number from decimal to binary, given in this chapter (15),...
Questions
question
Mathematics, 27.01.2021 18:50
question
Mathematics, 27.01.2021 18:50
question
Mathematics, 27.01.2021 18:50
Questions on the website: 13722367