# Arithmetic Operations in Assembly Language

Arithmetic instructions in assembly language perform **basic mathematical operations** on data in registers or memory.

## Addition (add)

Adds the values of two operands and stores the result.

## Subtraction (sub)

Subtracts the second operand from the first and stores the result.

## Multiplication (imul)

Multiplies two operands and stores the result. The imul instruction is used for signed integers.

## Division (idiv)

Divides the contents of a register by a specified value. The quotient is stored in the register, and the remainder in the special register edx.

## Increment (inc) and Decrement (dec)

Increments or decrements the value of a register or memory location by 1.

## Negation (neg)

Changes the sign of a value (multiplies it by -1).

## Absolute Value (abs)

Computes the absolute value of a signed integer.

Arithmetic instructions can be used to perform a wide variety of tasks, such as:

- Calculating the sum of two numbers
- Finding the difference between two numbers
- Calculating the product of two numbers
- Calculating the quotient of two numbers
- Converting a number from one base to another
- Generating random numbers
- Performing statistical calculations

### Conclusion

Arithmetic instructions facilitate fundamental mathematical operations on data, including addition, subtraction, multiplication, and division. These instructions **directly manipulate registers or memory locations** to perform computations and are essential for numerical data manipulation in low-level programming.

**Related Topics**