Nios/bcd8

From ASMBits

Binary-coded decimal is a method to represent decimal numbers encoded into binary. It uses each group of 4 bits (which can normally represent numbers from 0 to 15) to represent one decimal digit (of values 0 to 9).

Write a function that converts a number into its BCD representation. You are guaranteed that the input number will be between 0 and 99999999.

Sample Input

10

Sample Output

0x10

Write your solution here

Upload a source file...