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

23 lines
398 B
C
Raw Permalink Normal View History

2024-12-09 11:53:11 +01:00
#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;
}