Compare commits

...

3 Commits

Author SHA1 Message Date
tosu 7d6aa7b28c Add ft_print_comb.c 2023-03-17 01:08:11 +01:00
tosu 92dc1d827f Add ft_is_negative.c 2023-03-17 01:07:58 +01:00
tosu 18df1442cc Add ft_print_numbers.c 2023-03-17 01:07:34 +01:00
3 changed files with 119 additions and 0 deletions

33
ex03/ft_print_numbers.c Normal file
View File

@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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 ft_print_numbers(void)
{
int i;
i = '0';
while (i <= '9')
{
write(1, &i, 1);
i++;
}
}
/* ////
int main(void)
{
ft_print_numbers();
return (0);
}
*/ ////

35
ex04/ft_is_negative.c Normal file
View File

@ -0,0 +1,35 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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 ft_is_negative(int n)
{
if (n < 0)
{
write(1, "N", 1);
}
else
{
write(1, "P", 1);
}
}
/* ////
int main(void)
{
ft_is_negative(5);
ft_is_negative(0);
ft_is_negative(-5);
return (0);
}
*/ ////

51
ex05/ft_print_comb.c Normal file
View File

@ -0,0 +1,51 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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 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')
{
write(1, &a, 1);
write(1, &b, 1);
write(1, &c, 1);
if (a != '7')
{
write(1, ", ", 2);
}
c++;
}
b++;
}
a++;
}
}
/* ////
int main(void)
{
ft_print_comb();
return (0);
}
*/ ////