print integer to stdout using write or putchar?

C
#include "my_putchar.h"
/* 0x2D = '-'
 * 0x0 = NUL */
int my_put_nbr(int n)
{
        if (n < 0)
        {
                my_putchar(0x2D);
                n = -n;
        }

        if (n > 9)
        {
                my_put_nbr(n/10);
        }

        my_putchar((n%10) + '0');

        return 0;
}
Source

Also in C: