something like (untested):
void put_uint(unsigned int x)
{
char b, *p = b + 9;
unsigned int n;
b = 0;
do {
n = x / 10;
*--p = '0' + (x - n * 10);
} while ((x = n) != 0);
alt_putstr(p);
}
will output an unsigned value to the terminal in decimal.
The above will pull in the libc function to do divide (unless you added the hardware instruction and told gcc to use it).
The 'divide by constant' can be replaced by a multiply and shift, but that requires the 64bit result from the multiply - which altera don't have support for on the older fpgas (needs the DSP based multiply) and might need a 64bit shift. Splitting the value into two 16bit values does make this possible (I've done that to avoid needing 64bit divide when converting 'long long'.)
Writing printf() is just a SMOP (simple matter of programming).