2023-09-26 15:04:45 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
|
int hauteur_carre,etage,espace,forme,tour_etage,tour_etoile;
|
2023-09-26 17:18:31 +02:00
|
|
|
do{
|
|
|
|
|
printf("t) Triangle \nc)Carré \nq)Quitter\n");
|
|
|
|
|
scanf("%c",&forme);
|
|
|
|
|
if (forme=='q')
|
|
|
|
|
break;
|
|
|
|
|
else if (forme=='c') {
|
|
|
|
|
printf("Donnez un entier pour le nombre d'étage : ");
|
|
|
|
|
scanf("%d",&etage);
|
|
|
|
|
for (tour_etoile=0;tour_etoile<etage;tour_etoile++)
|
|
|
|
|
printf("* ");
|
|
|
|
|
printf("\n");
|
|
|
|
|
for (hauteur_carre=0;hauteur_carre<(etage-2);hauteur_carre++){
|
|
|
|
|
printf("* ");
|
|
|
|
|
for (espace=0;espace<(etage-2);espace++)
|
|
|
|
|
printf(" ");
|
|
|
|
|
printf("* ");
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
for (tour_etoile=0;tour_etoile<etage;tour_etoile++)
|
|
|
|
|
printf("* ");
|
|
|
|
|
printf("\n");
|
|
|
|
|
} else if (forme=='t') {
|
|
|
|
|
printf("Donnez un entier pour le nombre d'étage : ");
|
|
|
|
|
scanf("%d",&etage);
|
|
|
|
|
for (tour_etage=0;tour_etage<etage;tour_etage++){
|
|
|
|
|
for (tour_etoile=0;tour_etoile<=tour_etage;tour_etoile++)
|
|
|
|
|
printf("*");
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
getchar();
|
|
|
|
|
}while(forme!='q');
|
|
|
|
|
printf("Au revoir ...\n");
|
2023-09-26 15:04:45 +02:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
|
}
|