commit
This commit is contained in:
42
C_00/git/ex05/ft_print_comb.c
Normal file
42
C_00/git/ex05/ft_print_comb.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user