commit
This commit is contained in:
18
C_00/git/ex00/ft_putchar.c
Normal file
18
C_00/git/ex00/ft_putchar.c
Normal file
@@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putchar.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 13:11:26 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/06 09:21:17 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_putchar(char c)
|
||||
{
|
||||
write(1, &c, 1);
|
||||
}
|
||||
19
C_00/git/ex00/main.c
Normal file
19
C_00/git/ex00/main.c
Normal file
@@ -0,0 +1,19 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 13:12:43 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/05 13:17:47 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void ft_putchar(char c);
|
||||
|
||||
ft_putchar('Z');
|
||||
return (0);
|
||||
}
|
||||
6
C_00/git/ex00/main.sh
Executable file
6
C_00/git/ex00/main.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
norminette -R CheckForbiddenSourceHeader
|
||||
gcc -Wall -Wextra -Werror -o a.out *.c
|
||||
echo $(basename $PWD):
|
||||
./a.out
|
||||
rm -f a.out
|
||||
29
C_00/git/ex01/ft_print_alphabet.c
Normal file
29
C_00/git/ex01/ft_print_alphabet.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_print_alphabet.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 13:11:54 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/05 13:17:19 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_print_alphabet(void)
|
||||
{
|
||||
int start;
|
||||
int end;
|
||||
int i;
|
||||
|
||||
start = (int) 'a';
|
||||
end = (int) 'z';
|
||||
i = start;
|
||||
while (i <= end)
|
||||
{
|
||||
write(1, &i, 1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
19
C_00/git/ex01/main.c
Normal file
19
C_00/git/ex01/main.c
Normal file
@@ -0,0 +1,19 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 13:12:05 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/05 13:17:31 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void ft_print_alphabet(void);
|
||||
|
||||
ft_print_alphabet();
|
||||
return (0);
|
||||
}
|
||||
6
C_00/git/ex01/main.sh
Executable file
6
C_00/git/ex01/main.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
norminette -R CheckForbiddenSourceHeader
|
||||
gcc -Wall -Wextra -Werror -o a.out *.c
|
||||
echo $(basename $PWD):
|
||||
./a.out
|
||||
rm -f a.out
|
||||
29
C_00/git/ex02/ft_print_reverse_alphabet.c
Normal file
29
C_00/git/ex02/ft_print_reverse_alphabet.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_print_reverse_alphabet.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 13:13:58 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/05 13:17:00 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_print_reverse_alphabet(void)
|
||||
{
|
||||
int start;
|
||||
int end;
|
||||
int i;
|
||||
|
||||
start = (int) 'z';
|
||||
end = (int) 'a';
|
||||
i = start;
|
||||
while (i >= end)
|
||||
{
|
||||
write(1, &i, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
19
C_00/git/ex02/main.c
Normal file
19
C_00/git/ex02/main.c
Normal file
@@ -0,0 +1,19 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 13:14:21 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/05 13:17:07 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void ft_print_reverse_alphabet(void);
|
||||
|
||||
ft_print_reverse_alphabet();
|
||||
return (0);
|
||||
}
|
||||
6
C_00/git/ex02/main.sh
Executable file
6
C_00/git/ex02/main.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
norminette -R CheckForbiddenSourceHeader
|
||||
gcc -Wall -Wextra -Werror -o a.out *.c
|
||||
echo $(basename $PWD):
|
||||
./a.out
|
||||
rm -f a.out
|
||||
29
C_00/git/ex03/ft_print_numbers.c
Normal file
29
C_00/git/ex03/ft_print_numbers.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_print_numbers.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 13:15:47 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/05 13:16:35 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_print_numbers(void)
|
||||
{
|
||||
int start;
|
||||
int end;
|
||||
int i;
|
||||
|
||||
start = (int) '0';
|
||||
end = (int) '9';
|
||||
i = start;
|
||||
while (i <= end)
|
||||
{
|
||||
write(1, &i, 1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
19
C_00/git/ex03/main.c
Normal file
19
C_00/git/ex03/main.c
Normal file
@@ -0,0 +1,19 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 13:15:56 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/05 13:16:46 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void ft_print_numbers(void);
|
||||
|
||||
ft_print_numbers();
|
||||
return (0);
|
||||
}
|
||||
6
C_00/git/ex03/main.sh
Executable file
6
C_00/git/ex03/main.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
norminette -R CheckForbiddenSourceHeader
|
||||
gcc -Wall -Wextra -Werror -o a.out *.c
|
||||
echo $(basename $PWD):
|
||||
./a.out
|
||||
rm -f a.out
|
||||
24
C_00/git/ex04/ft_is_negative.c
Normal file
24
C_00/git/ex04/ft_is_negative.c
Normal file
@@ -0,0 +1,24 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_is_negative.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 13:18:29 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/05 13:45:21 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_is_negative(int n)
|
||||
{
|
||||
char c;
|
||||
|
||||
if (n < 0)
|
||||
c = 'N';
|
||||
else
|
||||
c = 'P';
|
||||
write(1, &c, 1);
|
||||
}
|
||||
23
C_00/git/ex04/main.c
Normal file
23
C_00/git/ex04/main.c
Normal file
@@ -0,0 +1,23 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 13:18:40 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/05 13:48:41 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void ft_is_negative(int n);
|
||||
|
||||
ft_is_negative(-42);
|
||||
ft_is_negative(42);
|
||||
ft_is_negative(0);
|
||||
return (0);
|
||||
}
|
||||
6
C_00/git/ex04/main.sh
Executable file
6
C_00/git/ex04/main.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
norminette -R CheckForbiddenSourceHeader
|
||||
gcc -Wall -Wextra -Werror -o a.out *.c
|
||||
echo $(basename $PWD):
|
||||
./a.out
|
||||
rm -f a.out
|
||||
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;
|
||||
}
|
||||
}
|
||||
21
C_00/git/ex05/main.c
Normal file
21
C_00/git/ex05/main.c
Normal file
@@ -0,0 +1,21 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 13:50:48 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/05 14:55:52 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void ft_print_comb(void);
|
||||
|
||||
ft_print_comb();
|
||||
return (0);
|
||||
}
|
||||
6
C_00/git/ex05/main.sh
Executable file
6
C_00/git/ex05/main.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
norminette -R CheckForbiddenSourceHeader
|
||||
gcc -Wall -Wextra -Werror -o a.out *.c
|
||||
echo $(basename $PWD):
|
||||
./a.out
|
||||
rm -f a.out
|
||||
40
C_00/git/ex06/ft_print_comb2.c
Normal file
40
C_00/git/ex06/ft_print_comb2.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_print_comb2.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 17:39:09 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/06 11:45:50 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_print_comb2(void)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
char str[2];
|
||||
|
||||
x = 0;
|
||||
while (x <= 99)
|
||||
{
|
||||
y = 1;
|
||||
while (y <= 99)
|
||||
{
|
||||
str[0] = (x / 10) + '0';
|
||||
str[1] = (x % 10) + '0';
|
||||
write(1, &str, 2);
|
||||
write(1, " ", 1);
|
||||
str[0] = (y / 10) + '0';
|
||||
str[1] = (y % 10) + '0';
|
||||
write(1, &str, 2);
|
||||
if (y != 99 || x != 99)
|
||||
write(1, ", ", 2);
|
||||
y++;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
}
|
||||
21
C_00/git/ex06/main.c
Normal file
21
C_00/git/ex06/main.c
Normal file
@@ -0,0 +1,21 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 17:38:55 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/05 17:39:00 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void ft_print_comb2(void);
|
||||
|
||||
ft_print_comb2();
|
||||
return (0);
|
||||
}
|
||||
6
C_00/git/ex06/main.sh
Executable file
6
C_00/git/ex06/main.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
norminette -R CheckForbiddenSourceHeader
|
||||
gcc -Wall -Wextra -Werror -o a.out *.c
|
||||
echo $(basename $PWD):
|
||||
./a.out
|
||||
rm -f a.out
|
||||
35
C_00/git/ex07/ft_putnbr.c
Normal file
35
C_00/git/ex07/ft_putnbr.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putnbr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 18:09:22 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/06 11:48:21 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_putnbr(int nb)
|
||||
{
|
||||
char str[10];
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
if (nb == 0)
|
||||
write(1, "0", 1);
|
||||
while (nb != 0)
|
||||
{
|
||||
str[i] = nb % 10 + '0';
|
||||
nb /= 10;
|
||||
i++;
|
||||
}
|
||||
while (i > 0)
|
||||
{
|
||||
--i;
|
||||
if (str[i] >= 48 && str[i] <= 57)
|
||||
write(1, &str[i], 1);
|
||||
}
|
||||
}
|
||||
28
C_00/git/ex07/main.c
Normal file
28
C_00/git/ex07/main.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/05 18:07:44 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/06 11:48:27 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void ft_putnbr(int nb);
|
||||
|
||||
ft_putnbr(-1);
|
||||
write(1, "\n", 1);
|
||||
ft_putnbr(0);
|
||||
write(1, "\n", 1);
|
||||
ft_putnbr(42);
|
||||
write(1, "\n", 1);
|
||||
ft_putnbr(2147483647);
|
||||
return (0);
|
||||
}
|
||||
6
C_00/git/ex07/main.sh
Executable file
6
C_00/git/ex07/main.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
norminette -R CheckForbiddenSourceHeader
|
||||
gcc -Wall -Wextra -Werror -o a.out *.c
|
||||
echo $(basename $PWD):
|
||||
./a.out
|
||||
rm -f a.out
|
||||
85
C_00/git/ex08/ft_print_combn.c
Normal file
85
C_00/git/ex08/ft_print_combn.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_print_combn.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/06 09:43:06 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/06 11:38:05 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_putnbr(int nb)
|
||||
{
|
||||
char str[10];
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
if (nb == 0)
|
||||
write(1, "0", 1);
|
||||
while (nb != 0)
|
||||
{
|
||||
str[i] = nb % 10 + '0';
|
||||
nb /= 10;
|
||||
i++;
|
||||
}
|
||||
while (i > 0)
|
||||
{
|
||||
--i;
|
||||
if (str[i] >= 48 && str[i] <= 57)
|
||||
write(1, &str[i], 1);
|
||||
}
|
||||
}
|
||||
|
||||
int power(int x, int n)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = 1;
|
||||
while (n--)
|
||||
r *= x;
|
||||
return (r);
|
||||
}
|
||||
|
||||
int ndigits(int n)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = 1;
|
||||
if (n < 0)
|
||||
{
|
||||
if (n == 0)
|
||||
n = 2147483647;
|
||||
else
|
||||
n = -n;
|
||||
}
|
||||
while (n > 9)
|
||||
{
|
||||
n /= 10;
|
||||
r++;
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
void ft_print_combn(int n)
|
||||
{
|
||||
int x;
|
||||
int z;
|
||||
int max;
|
||||
|
||||
max = power(10, n) - 1;
|
||||
x = 1;
|
||||
while (x <= max)
|
||||
{
|
||||
z = n - ndigits(x);
|
||||
while (z-- > 0)
|
||||
write(1, "0", 1);
|
||||
ft_putnbr(x);
|
||||
if (x != max)
|
||||
write(1, ", ", 2);
|
||||
x++;
|
||||
}
|
||||
}
|
||||
29
C_00/git/ex08/main.c
Normal file
29
C_00/git/ex08/main.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/06 09:41:51 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/06 11:32:04 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void ft_print_combn(int n);
|
||||
|
||||
ft_print_combn(1);
|
||||
write(1, "\n", 1);
|
||||
ft_print_combn(2);
|
||||
write(1, "\n", 1);
|
||||
ft_print_combn(3);
|
||||
write(1, "\n", 1);
|
||||
ft_print_combn(4);
|
||||
write(1, "\n", 1);
|
||||
return (0);
|
||||
}
|
||||
6
C_00/git/ex08/main.sh
Executable file
6
C_00/git/ex08/main.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
norminette -R CheckForbiddenSourceHeader
|
||||
gcc -Wall -Wextra -Werror -o a.out *.c
|
||||
echo $(basename $PWD):
|
||||
./a.out
|
||||
rm -f a.out
|
||||
Reference in New Issue
Block a user