This repository contains the program extra_c.c
, which converts a hexadecimal number to binary and decimal representations, including two's complement representation for a 16-bit processor.
The extra_c.c
program performs the following tasks:
- Converts a hexadecimal number to its binary representation.
- Converts a hexadecimal number to its decimal representation (unsigned).
- Converts a binary number to its decimal representation, considering the two's complement.
To compile and run the program, follow these steps:
-
Compile the program using the
gcc
compiler:gcc extra_c.c -o extra_c
-
Run the compiled program:
./extra_c
After running, the program will display the conversion results for the hexadecimal number A200:
Hexadecimal: A200
Binary (16 bits): 1010001000000000
Decimal (unsigned): 41472
Decimal (two's complement): -24064