Shayaan-Kashif / Number-Base-Converter

This program converts numbers between Decimal, binary and Hexadecimal
0 stars 0 forks source link

Uneven number Binary to Hex Conversion #1

Closed Shayaan-Kashif closed 5 hours ago

Shayaan-Kashif commented 1 day ago

When converting from Binary to Hex if the input binary number is uneven the code may not work as intended. For example given the input of 10 0110 0101 the result should be 265. However the code computes it as 4C. On the contrary a binary input of 010 should result in 2 and the code works given that input. Screenshot 2024-09-18 at 10 37 14 PM Screenshot 2024-09-18 at 10 37 03 PM

Willev05 commented 5 hours ago

Line 149 is missing the % 4 operator leading to it checking if the length itself == 2. Fixed, tested and works. image