/*
func displays nub entered as prmt
-all possible val within int type var
-recursive, unsigned int
*/
#include <unistd.h>
void ft_putchar(char c) {
write(1, &c, 1);
}
//take account : signed int case too!! (- nb)
void ft_putnbr(unsigned int n) {
if (n >= 10) {
ft_putnbr(n / 10); // Recursively call ft_putnbr with the quotient
}
ft_putchar((n % 10) + '0'); // Convert the last digit to a character and print
}
int main() {
ft_putnbr(42); // Example call to ft_putnbr
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: