answersLogoWhite

0


Best Answer

The hexadecimal notation is base-16, so for small numbers, arrange them right to left as powers of 16 (units 0 to 9 and A through F representing 10, 11, 12, 13, 14, and 15).

Examples: 21 = 15 hex (16+5) and 31 = 1F (16+15)

For larger numbers, see the process at the related link below.

Here is a program:

#include

#include

void main()

{

int n;

clrscr();

printf("Enter Decimal Number: ");

scanf("%d",&n);

printf("Hexadecimal value is: %x",n);

getch();

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

One of the basic skills a programmer needs is the ability to convert numbers between decimal, hexadecimal, and binary. This article will demonstrate the conversions between each of these bases. Decimal to Hexadecimal Here is an algorithm to convert a decimal integer to hexadecimal: 1) Let X be the decimal integer you wish to convert and let k = 1. 2) Divide X by 16, saving the quotient as Q, and the remainder (in hexadecimal) as Rk . 3) If Q is not zero, let X = Q, k = k + 1, and go back to step 2. Otherwise go to step 4. 4) Assume steps 1-3 were repeated n times. Arrange the remainders as a string of digits - RnRn-1Rn-2…R3R2R1 . Here is an example where we number and describe each iteration of the algorithm: 1) Let X = 954 and let k = 1. Dividing by 16 we have Q = 59 and R1 = A (10 = A in hexadecimal). Since Q is not zero, we let X = 59 and go back to start the second iteration. 2) Dividing X = 59 by 16, we have Q = 3 and R2 = B since 11 = B in hexadecimal. Since Q is not zero, we let X = 3 and start the third iteration. 3) Dividing X = 3 by 16, we have Q = 0 and R3 = 3. Since Q = 0, the loop terminates and the algorithm is completed by arranging the remainders as "3BA". Here is another example using long division. In this example we convert 2623 in decimal to A3F in hexadecimal. The computations move from right to left. FROM http://csc.colstate.edu/woolbright/CONV.HTM

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Algorithm of conversion decimal to hexadecimal?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the word for H stand for in binary to Decimal Conversion?

hexadecimal, eg. 1ABH = 1AB(16) = 427(10)


What is 68 in hexadecimal?

The question is ambiguous:what is 68 in hexadecimal when converted to decimal, orwhat is 68 in decimal when converted to hexadecimal.


What are the decimal and hexadecimal equivalents of the binary number 10011101?

10011101: Decimal = 157 Hexadecimal = 9D


How do you solve octa-hexadecimal?

That depends what you want to "solve" for - in other words, what the question is. For example, whether you want to:* Convert from hexadecimal to decimal* Convert from decimal to hexadecimal* Count in hexadecimal* Add hexadecimal numbers* etc.


Convert hexadecimal to 4?

4 is 4 in hexadecimal of decimal.


What follows 19 in hexadecimal?

19 in hexadecimal is 25 in decimal. 20 follows it and is 26 in hexadecimal.19 in decimal is 13 in hexadecimal. 20 in decimal is 14 in hexadecimal.


What is 1976 in hexadecimal?

The decimal number 1976 is represented in hexadecimal as 7B8.


What is 999910 in hexadecimal?

The value in hexadecimal of the decimal number 999910 is F41E6.


What is DCE and what is its hexadecimal value in decimal?

DCE means: Data Carrier Equipment Hexadecimal value in decimal: 3192


What is the hexadecimal for 11111011010?

If the above is decimal then in hexadecimal it is 2964492C2. If it is binary then in hexadecimal it is 7DA. If it is octal then in hexadecimal it is 49241208.


Convert hexadecimal no BB895C tO octal and decimal?

Hexadecimal -> BB895Cdecimal -> 12.290.396octal -> 56.704.534


What is the hexadecimal conversion of ABCD into octal no?

125715