56 lines
959 B
C
56 lines
959 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
/*int main(void){
|
||
|
int hauteur = 0;
|
||
|
int i;
|
||
|
int espace;
|
||
|
int etoile;
|
||
|
int n = 1;
|
||
|
int x = 0;
|
||
|
|
||
|
printf("entrer la hauteur du sapin: ");
|
||
|
scanf("%d", &hauteur);
|
||
|
|
||
|
for (i = 0; i < hauteur; i++){
|
||
|
|
||
|
for(espace = 0; espace < hauteur - 1 - i; espace++){
|
||
|
printf(" ");
|
||
|
}
|
||
|
|
||
|
|
||
|
for(etoile = 0; etoile < n; etoile++){
|
||
|
printf("*");
|
||
|
}
|
||
|
n += 2;
|
||
|
printf("\n");
|
||
|
}
|
||
|
|
||
|
}*/
|
||
|
|
||
|
int main(void){
|
||
|
char triangle;
|
||
|
int hauteur = 0;
|
||
|
int i;
|
||
|
int n = 0;
|
||
|
int etoile;
|
||
|
|
||
|
printf("entrer votre choix: ");
|
||
|
scanf("%c", &triangle);
|
||
|
|
||
|
if(triangle == 't'){
|
||
|
printf("entrer la hauteur du sapin: ");
|
||
|
scanf("%d", &hauteur);
|
||
|
|
||
|
for (i = 0; i < hauteur; i++){
|
||
|
|
||
|
for(etoile = 0; etoile < n; etoile++){
|
||
|
printf("*");
|
||
|
}
|
||
|
|
||
|
n += 2;
|
||
|
printf("\n");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|