About conversion of number systems | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

About conversion of number systems

how to print the exchanges of integers by creating an array? such as 2345 of decimals,and change the example into hexadecimal? and another problem is achieve the goal by using dynamic array?

30th Dec 2017, 4:58 AM
Lzq_0820
Lzq_0820 - avatar
2 Answers
+ 2
Actually, I wouldn't use an array... Especially beacouse you have to convert integers in to char(10 = a in hexadecimal). First you have to convert the number in binary (and that's easy, I'll put an example code in the description), the you have to divide the binary code in to nibbles (groups of four digits starting from right to left, from the LSB to the MSB, and add digits to the last nibble if it isn't formed by four digits, Example: 101101, you have to add 00 before 101101, so it will be 00101101), after doing this, you have to convert each nibble in to hexadecimal, (maybe using switch()) or you can convert every nibble from binary to decimal, and from decimal to hexadecimal.
3rd Jan 2018, 5:27 AM
CuriousCI
CuriousCI - avatar
3rd Jan 2018, 5:28 AM
CuriousCI
CuriousCI - avatar