DEV/DEV1.1/TP05:Boucles/Boucles:suite/Boucles:encore/figures.c
2022-10-11 11:28:13 +02:00

49 lines
894 B
C

#include <stdio.h>
#include <stdlib.h>
int main() {
char n;
int h;
int i;
int j;
int e;
int z=0;
while(z==0){
printf("_______________\nt) Triangle\nc) Carre\nq) Quitter\nVotre choix ? ");
scanf(" %c",&n);
if (n=='t'){
printf("Hauteur ? ");
scanf("%d",&h);
for (i=0;i<=h;i++){
for (j=h-i;j>0;j--){
} for (e=0;e<i;e++){
printf("*");
} printf("\n");
}
} else{
if (n=='c'){
printf("Hauteur ? ");
scanf("%d",&h);
for (i=1;i<=h;i++){
for (j=1;j<=h;j++){
if (j==1||j==h){
printf("* ");
} else{
if (i==1||i==h){
printf("* ");
}else{
printf(" ");
}
}
}printf("\n");
}
}else{
if(n=='q'){
printf("Au revoir...\n\n");
break;
}
}
}
}
return 0;
}