Number Bases Cpu Binary
1. **Find the Octal equivalent of 143Hex**
- Given hexadecimal: $143_{16}$
- Step 1: Convert hex to decimal
$$1 \times 16^2 + 4 \times 16^1 + 3 \times 16^0 = 1 \times 256 + 4 \times 16 + 3 = 256 + 64 + 3 = 323_{10}$$
- Step 2: Convert decimal to octal
Divide 323 by 8 repeatedly and record remainders:
$$323 \div 8 = 40 \text{ remainder } 3$$
$$40 \div 8 = 5 \text{ remainder } 0$$
$$5 \div 8 = 0 \text{ remainder } 5$$
- Write remainders from last to first: $503_8$
**Answer:** $503_8$
2. **List the three components of the CPU**
- The CPU has three main components:
1. Arithmetic Logic Unit (ALU): Performs arithmetic and logical operations.
2. Control Unit (CU): Directs the operation of the processor.
3. Registers: Small storage locations that hold data and instructions temporarily.
3. **Evaluate $(BEE)_{16} + (ACE)_{16}$ and give the answer in binary**
- Convert both hex numbers to decimal:
$$BEE_{16} = 11 \times 16^2 + 14 \times 16^1 + 14 \times 16^0 = 11 \times 256 + 14 \times 16 + 14 = 2816 + 224 + 14 = 3054_{10}$$
$$ACE_{16} = 10 \times 16^2 + 12 \times 16^1 + 14 \times 16^0 = 10 \times 256 + 12 \times 16 + 14 = 2560 + 192 + 14 = 2766_{10}$$
- Add decimal values:
$$3054 + 2766 = 5820_{10}$$
- Convert sum to binary:
Divide by 2 and track remainders:
$$5820_{10} = 1011011000100_2$$
(To confirm, can convert or use standard base10 to binary conversion.)
**Answer:** $1011011000100_2$
4. **Write a complete C program that adds integer multiples of 5 from 5 up to 100**
```c
#include
int main() {
int sum = 0;
for (int i = 5; i <= 100; i += 5) {
sum += i;
}
printf("Sum of multiples of 5 from 5 to 100 is: %d\n", sum);
return 0;
}
```
This program uses a for loop starting at 5, increments by 5 each iteration until 100. It keeps a running total in the variable `sum`, then prints the result.
**Answer:** Program above calculates the sum as 1050.