40 lines
794 B
C
40 lines
794 B
C
# include <stdio.h>
|
|
# include <stdlib.h>
|
|
|
|
int main(void) {
|
|
int hauteur;
|
|
char choix;
|
|
int i;
|
|
int j;
|
|
printf("_______________\n t) Triangle\n c) Carré\n q) Quitter\n Votre choix ? ");
|
|
choix = getchar();
|
|
while (choix != 'q') {
|
|
printf("\n\nHauteur ? ");
|
|
scanf("%d", &hauteur);
|
|
if (choix == 't') {
|
|
for (i = 0; i != hauteur; i++) {
|
|
for (j = 0; j != i; j++) {
|
|
printf("*");
|
|
}
|
|
printf("\n");
|
|
}
|
|
}
|
|
else {
|
|
for (i = 0; i != hauteur; i++) {
|
|
printf("*");
|
|
}
|
|
printf("\n");
|
|
for (i = 0; i != (hauteur - 2); i++) {
|
|
printf("*");
|
|
for (j = 0; j != (hauteur - 2); j++) {
|
|
printf(" ");
|
|
}
|
|
printf("*\n");
|
|
}
|
|
}
|
|
printf("_______________\n t) Triangle\n c) Carré\n q) Quitter\n Votre choix ? ");
|
|
choix = getchar();
|
|
}
|
|
return EXIT_SUCCESS;
|
|
}
|