Developpement/23DEV1.1/TPS1/TP01/07-Boucles/BouclesBis/BoucleBisbis/sapin.c

23 lines
398 B
C

#include <stdio.h>
#include <stdlib.h>
int main(void) {
int i;
int j;
int n;
printf("hauteur du sapin : ");
scanf("%d",&n);
printf("\n");
for(i=0;i<n;i++){
printf(" ");
for(j=0;j<n*2;j++){
if(n-1-i<=j&&j<=n-1+i){
printf("*");
}
else{
printf(" ");
}
}
printf("\n");
}
return EXIT_SUCCESS;
}