-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_print_comb2.c
65 lines (57 loc) · 1.49 KB
/
ft_print_comb2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: danalvar <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/20 19:50:42 by danalvar #+# #+# */
/* Updated: 2024/10/21 20:29:22 by danalvar ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void write_num(char n1, char n2)
{
char c11;
char c12;
char c21;
char c22;
c11 = n1 / 10 + '0';
c12 = n1 % 10 + '0';
c21 = n2 / 10 + '0';
c22 = n2 % 10 + '0';
write(1, &c11, 1);
write(1, &c12, 1);
write(1, " ", 1);
write(1, &c21, 1);
write(1, &c22, 1);
if (n1 == 98 && n2 == 99)
return ;
else
write (1, ", ", 2);
}
void ft_second_group(int n1)
{
int n2;
n2 = n1 + 1;
while (n2 < 100)
{
write_num(n1, n2);
n2 ++;
}
}
void ft_print_comb2(void)
{
int n1;
n1 = 0;
while (n1 < 100)
{
ft_second_group(n1);
n1++;
}
}
/*int main(void)
{
ft_print_comb2();
return (0);
}*/