This commit is contained in:
Simoes Lukas
2024-09-24 15:03:19 +02:00
parent ab52c40223
commit bda03135c6
5 changed files with 197 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
------- TP09 : Boucles (encore) -------
1.
# include <stdio.h>
# include <stdlib.h>
int main(void) {
int hauteur;
int temp_espaces;
int temp_etoiles;
int i;
int j;
temp_etoiles = 1;
printf("Hauteur ? ");
scanf("%d", &hauteur);
printf("\n");
temp_espaces = hauteur - 1;
for (; hauteur != 0; hauteur -= 1) {
for (i = 0; i != temp_espaces; i += 1) {
printf(" ");
}
temp_espaces -= 1;
for (j = 0; j != temp_etoiles; j += 1) {
printf("*");
}
temp_etoiles += 2;
printf("\n");
}
return EXIT_SUCCESS;
}
--------------------------------------------
2.