55 lines
1.3 KiB
C
55 lines
1.3 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_print_comb.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2022/07/14 14:18:48 by cchauvet #+# #+# */
|
||
|
/* Updated: 2022/07/14 15:10:35 by cchauvet ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include <unistd.h>
|
||
|
|
||
|
void ft_putchar(char c)
|
||
|
{
|
||
|
write(1, &c, 1);
|
||
|
}
|
||
|
|
||
|
void ft_result(char x, char y, char z)
|
||
|
{
|
||
|
ft_putchar(x);
|
||
|
ft_putchar(y);
|
||
|
ft_putchar(z);
|
||
|
if (!((x == '7') && (y == '8') && (z == '9')))
|
||
|
{
|
||
|
ft_putchar(',');
|
||
|
ft_putchar(' ');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void ft_print_comb(void)
|
||
|
{
|
||
|
char x;
|
||
|
char y;
|
||
|
char z;
|
||
|
|
||
|
x = '0';
|
||
|
while (x <= '7')
|
||
|
{
|
||
|
y = x + 1;
|
||
|
while (y <= '8')
|
||
|
{
|
||
|
z = y + 1;
|
||
|
while (z <= '9')
|
||
|
{
|
||
|
ft_result(x, y, z);
|
||
|
z++;
|
||
|
}
|
||
|
y++;
|
||
|
}
|
||
|
x++;
|
||
|
}
|
||
|
}
|