#include <unistd.h>
void ft_putnbr(int nb)
{
char c;
unsigned int num;
/*if (nb < 10)
{
if (nb < 0)
{
} else {
c = nb + 48;
write (1, &c, 1);
}
} else {
}*/
if (nb < 0)
{
nb *= -1;
// num = nb;
// c = num + 48;
write (1, "-", 1);
}
if(nb >= 10){
num = nb;
ft_putnbr(num / 10);
ft_putnbr(num % 10);
}else{
c = nb + 48;
write (1, &c, 1);
}
}
int main() {
ft_putnbr(-3);
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: