0
0
Files
42piscine/C_00/git/ex05/ft_print_comb.c
Guy Baconniere d30270c485 commit
2021-08-20 10:02:38 +02:00

43 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/05 13:51:00 by gbaconni #+# #+# */
/* Updated: 2021/08/05 17:36:28 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_comb(void)
{
int x;
int y;
int z;
char str[3];
x = 0;
y = 1;
z = 2;
while (x <= 7)
{
while (y <= 8)
{
while (z <= 9)
{
str[0] = x + '0';
str[1] = y + '0';
str[2] = z + '0';
write(1, &str, 3);
if (z++ != 9 || y != 8 || x != 7)
write(1, ", ", 2);
}
z = ++y + 1;
}
y = ++x;
}
}