43 lines
1.2 KiB
C
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;
|
|
}
|
|
}
|