first commit
This commit is contained in:
50
finish/C00/ex06/ft_print_comb2.c
Normal file
50
finish/C00/ex06/ft_print_comb2.c
Normal file
@ -0,0 +1,50 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_print_comb2.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/07/13 11:13:23 by adjoly #+# #+# */
|
||||
/* Updated: 2023/07/16 13:29:28 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_print_nbr(int a, int b)
|
||||
{
|
||||
char c;
|
||||
char d;
|
||||
char e;
|
||||
char f;
|
||||
|
||||
c = a / 10 + 48;
|
||||
d = a % 10 + 48;
|
||||
e = b / 10 + 48;
|
||||
f = b % 10 + 48;
|
||||
write(1, &c, 1);
|
||||
write(1, &d, 1);
|
||||
write(1, " ", 1);
|
||||
write(1, &e, 1);
|
||||
write(1, &f, 1);
|
||||
if (!(c == '9' && d == '8' && e == '9' && f == '9'))
|
||||
write(1, ", ", 2);
|
||||
}
|
||||
|
||||
void ft_print_comb2(void)
|
||||
{
|
||||
int a;
|
||||
int b;
|
||||
|
||||
a = 0;
|
||||
while (a <= 98)
|
||||
{
|
||||
b = a + 1;
|
||||
while (b <= 99)
|
||||
{
|
||||
ft_print_nbr(a, b);
|
||||
b++;
|
||||
}
|
||||
a++;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user