Fin TP10
This commit is contained in:
33
DEV1.1/TP09/#TP09_reponses.txt#
Normal file
33
DEV1.1/TP09/#TP09_reponses.txt#
Normal file
@@ -0,0 +1,33 @@
|
||||
------- 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.
|
Reference in New Issue
Block a user