DEV/DEV1.1/TP09/sapin.c
Bekkouche Anis 1765a453cf ejeejh
2024-10-07 17:30:04 +02:00

45 lines
770 B
C

#include <stdio.h>
#include <stdlib.h>
int main(void) {
int hauteur;
char space = ' ';
char etoile = '*';
int n_space;
int n_etoile = 1;
int n1_etoile = n_etoile;
int nf_etoile = 11;
printf("Hauteur ? ");
scanf("%d", &hauteur);
for (; n_etoile <= nf_etoile; n_etoile++){
n_space = 11 - n_etoile;
while (n_space > 0) {
printf("%c", space);
n_space--;
if (n_space == 0){
printf("\n");
break;
}
}
n_space = 11 - n1_etoile;
while (n1_etoile <= 11) {
printf("%c", etoile);
n1_etoile--;
if (n1_etoile == 0){
printf("\n");
break;
}
}
while (n_space > 0) {
printf("%c", space);
n_space--;
if (n_space == 0){
printf("\n");
break;
}
}
}
}