DEV_BUT1/DEV1.1/TP06/main.c

28 lines
590 B
C
Raw Normal View History

2022-10-18 14:50:36 +02:00
#include <stdio.h>
#include <stdlib.h>
int main(void){
int hauteur;
int i;
int a;
int b;
int espace;
int etoile;
printf("Hauteur de l'arbre :");
scanf("%d", &hauteur);
int acc=hauteur-1;
espace = hauteur-1;
etoile = 1;
for(i = hauteur ; i >= 0 ; i = i-1){
for(b = 0; b <= espace ; b = b+1){
printf(" ");
}
for(a = 0; a < etoile; a= a+1){
printf("*");
}
printf("\n");
espace=espace-1;
etoile=etoile+2;
}
return EXIT_SUCCESS;
}