Files
DEV/DEV1.1/TP08/sapin.c
2023-09-26 15:04:45 +02:00

21 lines
514 B
C

#include <stdio.h>
#include <stdlib.h>
int main(void) {
int nbr_etoile=1,etage,espace,tour_etage,tour_espace,tour_etoile;
printf("Donnez un entier pour le nombre d'étage : ");
scanf("%d",&etage);
espace=(etage-1)*2;
for (tour_etage=0;tour_etage<etage;tour_etage++){
for (tour_espace=0;tour_espace<(espace/2);tour_espace++){
printf(" ");
}
for (tour_etoile=0;tour_etoile<nbr_etoile;tour_etoile++){
printf("*");
}
printf("\n");
nbr_etoile+=2;
espace-=2;
}
return EXIT_SUCCESS;
}