-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putnbr_base.c
25 lines (23 loc) · 1.16 KB
/
ft_putnbr_base.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_base.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ytaya <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/20 14:22:00 by ytaya #+# #+# */
/* Updated: 2021/11/21 17:53:42 by ytaya ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_putnbr_base(unsigned long nbr, char *base)
{
if (nbr >= (unsigned long) ft_strlen(base))
{
ft_putnbr_base(nbr / ft_strlen(base), base);
ft_putnbr_base(nbr % ft_strlen(base), base);
}
else
ft_putchar(base[nbr]);
return (ft_len(nbr, ft_strlen(base)));
}