-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex2b.c
executable file
·45 lines (32 loc) · 900 Bytes
/
ex2b.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
#include <stdio.h>
#include <stdlib.h>
#define TAILLE 10
#define NBRE 3
int main ()
{
for (int i = 0; i < TAILLE; i++){
for (int a = 0; a < NBRE; a++){
for (int j = 0; j < TAILLE - i - 1; j++)
printf(" ");
for (int j = 0; j < 2 * (i + 1) - 1; j++)
printf("*");
for (int j = 0; j < TAILLE - i - 1; j++)
printf(" ");
printf(" ");
}
printf("\n");
}
// le sujet n'est pas clair si le tronc doit faire 4 lignes ou 5 lignes
for (int k = 0; k < 5; k++) {
for (int a = 0; a < NBRE; a++){
for (int i = 0; i < TAILLE - 3; i++)
printf(" ");
printf("||||");
for (int i = 0; i < TAILLE - 2; i++)
printf(" ");
printf(" ");
}
printf("\n");
}
return 0;
}