piscine-c00/ex05/ft_print_comb.c

57 lines
1.3 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_reverse_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/15 21:50:37 by tischmid #+# #+# */
/* Updated: 2023/03/16 05:00:01 by tischmid ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void print_abc(char a, char b, char c)
{
write(1, &a, 1);
write(1, &b, 1);
write(1, &c, 1);
if (a != '7')
{
write(1, ", ", 2);
}
}
void ft_print_comb(void)
{
int a;
int b;
int c;
a = '0';
while (a <= '7')
{
b = a + 1;
while (b <= '8')
{
c = b + 1;
while (c <= '9')
{
print_abc(a, b, c);
c++;
}
b++;
}
a++;
}
}
/* ////
int main(void)
{
ft_print_comb();
return (0);
}
*/ ////