Compare commits

..

2 Commits

Author SHA1 Message Date
lclerel- lclerel-
9986e5a611 Ex1 et Ex2 fait 2026-03-05 15:59:01 +01:00
lclerel- lclerel-
e08aa8e656 Ex1 et Ex2 fait 2026-03-05 15:58:51 +01:00
3 changed files with 53 additions and 3 deletions

View File

@@ -6,7 +6,7 @@
/* By: lclerel- <lclerel-@learner.42.tech> +#+ +:+ +#+ */ /* By: lclerel- <lclerel-@learner.42.tech> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2026/03/05 09:00:24 by lclerel- #+# #+# */ /* Created: 2026/03/05 09:00:24 by lclerel- #+# #+# */
/* Updated: 2026/03/05 12:01:35 by lclerel- ### ########.fr */ /* Updated: 2026/03/05 15:40:40 by lclerel- ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -45,8 +45,8 @@ void ft_print_comb(void)
} }
} }
int main(void) /*int main(void)
{ {
ft_print_comb(); ft_print_comb();
return (0); return (0);
} }*/

50
ex2/ft_print_comb2.c Normal file
View File

@@ -0,0 +1,50 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lclerel- <lclerel-@learner.42.tech> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/03/05 13:45:48 by lclerel- #+# #+# */
/* Updated: 2026/03/05 15:56:57 by lclerel- ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void print(char a, char space, char b)
{
write(1, &"0123456789"[a / 10], 1);
write(1, &"0123456789"[a % 10], 1);
write(1, &space, 1);
write(1, &"0123456789"[b / 10], 1);
write(1, &"0123456789"[b % 10], 1);
if (!(a == 98 && b == 99))
write(1, ", ", 2);
}
void ft_print_comb2(void)
{
char space;
char a;
char b;
space = ' ';
a = 0;
while (a <= 98)
{
b = a + 1;
while (b <= 99)
{
print(a, space, b);
b++;
}
a++;
}
}
int main(void)
{
ft_print_comb2();
return (0);
}

0
ex3/ft_combn.c Normal file
View File