49 lines
1.3 KiB
C
49 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_print_comb.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/07/12 23:26:35 by adjoly #+# #+# */
|
|
/* Updated: 2023/07/13 11:45:59 by adjoly ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
#include <unistd.h>
|
|
|
|
void ft_print_virgule(char a, char b, char c)
|
|
{
|
|
if (!(a == '7' && b == '8' && c == '9'))
|
|
{
|
|
write(1, ",", 1);
|
|
write(1, " ", 1);
|
|
}
|
|
}
|
|
|
|
void ft_print_comb(void)
|
|
{
|
|
char a;
|
|
char b;
|
|
char c;
|
|
|
|
a = '0';
|
|
while (a <= '7')
|
|
{
|
|
b = a + 1;
|
|
while (b <= '8')
|
|
{
|
|
c = b + 1;
|
|
while (c <= '9')
|
|
{
|
|
write(1, &a, 1);
|
|
write(1, &b, 1);
|
|
write(1, &c, 1);
|
|
ft_print_virgule(a, b, c);
|
|
c++;
|
|
}
|
|
b++;
|
|
}
|
|
a++;
|
|
}
|
|
}
|