answersLogoWhite

0

How do you add hexadecimal?

Updated: 8/11/2023
User Avatar

Wiki User

12y ago

Best Answer

Hexadecimal numbers can be manipulated in exactly the same was as decimal. The digits we can use are: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. Let us take two numbers, say, 7 and 6. In decimal, we can count from 7 upward by 6... 8, 9, 10, 11, 12, 13. In Hexadecimal, we can do the same... 8, 9, A, B, C, D. Let's take two more numbers, D and 4. We count upwards from D by 4... E, F, 10, 11. Notice that after F, there is no other digit we can use, to we carry 1 to the 16's column and carry on counting to reach the final figure of 11Hex. This is just the same as the decimal procedure of carrying to the tens column after we pass 9. Once you have got your head around the idea of extra digits, the rest of it is as easy as decimal.

User Avatar

Wiki User

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

Wiki User

15y ago

Pretty much the same way that you add decimal numbers, except that you roll over to the next digit after 7 instead of 9. 1+1 = 2 2+2 = 4 3+3 = 6 4+4 = 10 5+5 = 12 6+6 = 14 7+7 = 16 10+10 = 20 11+11 = 22 Or you can convert to decimal, add, convert back if that's easier. 11o = 1*8^1 + 1*8^0 = 9d 9+9d = 18d 18d = 22o

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

If you mean using the programming language, it'll do it automagically, for example, if you have in C:

int a = 0x389;

int b = 0x7A8;

int c = a + b;

then c will contain 0xB31 (in hexadecimal) - to display the value you would use:

printf("a + b = %X + %X = %X = c\n", a, b, c);

You can also convert to hexadecimal (for display) directly, for example:

printf("0x%x + 0x%x = 0x%x\n", 127, 207, 127 + 207);

which will display the sum in hex:

0x7f + 0xcf = 0x14e

Hex is only a convenient way to display the numbers to humans.

If you mean manually, yourself, then exactly the same way that you add in any other base.

Start at the right hand end, add the digits together and when it becomes greater than the highest digit that can be stored in a single digit, subtract multiples of the base, write the remaining digit in the answer and the number of multiples of the base subtracted is added as a carry to the next digit sum to the left.

With hexadecimal, just remember that:

0x8 + 1 = 0x9

0x9 + 1 = 0xA

0xA + 1 = 0xB

0xB + 1 = 0xC

0xC + 1 = 0xD

0xD + 1 = 0xE

0xE + 1 = 0xF

0xF + 1 = 0x10

A trick to thinking in hexadecimal is to remember that 8 is 1/2 of 16 and think of the digits above 7 as (8 + [0-7]), that is:

0x8 = (8 + 0), 0x9 = (8 + 1), 0xA = (8 + 2), 0xB = (8 + 3)

0xC = (8 + 4), 0xD = (8 + 5), 0xE = (8 + 6), 0xF = (8 + 7)

and remembering that 0x8 + 0x8 = 0x10.

Example:

0x389 + 0x7A8 = 0xB31

0x9 + 0x8 (= 8 + 1 + 8 = 0x10 + 1) = 0x11 = 0x1 carry 1

0x8 + 0xA + carry 1 (= 8 + 8 + 2 + 1 = 0x10 + 3) = 0x13 = 0x3 carry 1

0x3 + 0x7 + carry 1 (= 8 + 3) = 0xB

If you can't think using the fifteen single digits, work in decimal remembering the conversions:

0xA = 10

0xB = 11

0xC = 12

0xD = 13

0xE = 14

0xF = 15

For example the second addition above becomes:

0x8 + 0xA + carry 1 = 8 + 10 + 1 = 19 (= 16 + 3 = 0x10 + 3) = 0x13 = 0x3 carry 1

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you add hexadecimal?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How many five digit hexadecimal strings are there?

Considering the lowest five digit hexadecimal number is 10000 (65,536) and the highest is FFFFF (1,048,575), there are 983,040 different hexadecimal numbers that are five digits.


What is the hexadecimal numbers for 66?

42


What is the hexadecimal of 990?

990 = 3DE


What is IC 74154?

hexadecimal decoder


Write a program that prints a table of the binary octal and hexadecimal equivalents of the decimal numbers in the range 1 through to 256?

import java.util.Scanner; public class NumberSystem { public void displayConversion() { Scanner input = new Scanner(System.in); System.out.printf("%-20s%-20s%-20s%-20s\n", "Decimal", "Binary", "Octal", "Hexadecimal"); for ( int i = 1; i <= 256; i++ ) { String binary = Integer.toBinaryString(i); String octal = Integer.toOctalString(i); String hexadecimal = Integer.toHexString(i); System.out.format("%-20d%-20s%-20s%-20s\n", i, binary, octal, hexadecimal); } } // returns a string representation of the decimal number in binary public String toBinaryString( int dec ) { String binary = " "; while (dec >= 1 ) { int value = dec % 2; binary = value + binary; dec /= 2; } return binary; } //returns a string representation of the number in octal public String toOctalString( int dec ) { String octal = " "; while ( dec >= 1 ) { int value = dec % 8; octal = value + octal; dec /= 8; } return octal; } public String toHexString( int dec ) { String hexadecimal = " "; while ( dec >= 1 ) { int value = dec % 16; switch (value) { case 10: hexadecimal = "A" + hexadecimal; break; case 11: hexadecimal = "B" + hexadecimal; break; case 12: hexadecimal = "C" + hexadecimal; break; case 13: hexadecimal = "D" + hexadecimal; break; case 14: hexadecimal = "E" + hexadecimal; break; case 15: hexadecimal = "F" + hexadecimal; break; default: hexadecimal = value + hexadecimal; break; } dec /= 16; } return hexadecimal; } public static void main( String args[]) { NumberSystem apps = new NumberSystem(); apps.displayConversion(); } }

Related questions

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.


What is the hexadecimal for 187649984473770?

AAAAAAAAAAAA is the Hexadecimal.


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.


1 To develop a program using the ADI instruction to add the two hexadecimal numbers 3AH and 48H and store the result in memory location 2100H?

Write a program using the ADI instruction to add the two hexadecimal numbers 3AH and 48H and store the result in memory location 2100H


What is the hexadecimal of 234?

234 in hexadecimal is EA.


How do you do hexadecimal?

That depends what you want to "do" with the hexadecimals - add, multiply, compare, etc. The first thing you would need to do is learn how it is defined.


What is the hexadecimal for 14?

The hexadecimal for 14 is the letter E.


What is binary 100110 in hexadecimal?

It equates to 26 in hexadecimal.


What is hexadecimal number for11101011000111010 can be written in hexadecimal as?

D63A


What is 60 in hexadecimal?

60 in hexadecimal would be 3C


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.


Convert hexadecimal to 4?

4 is 4 in hexadecimal of decimal.