DEV/DEV1.1/TP05:Boucles/Boucles:suite/Boucles:encore/figures.c

49 lines
894 B
C
Raw Normal View History

2022-10-04 17:58:52 +02:00
#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");
}
2022-10-11 11:28:13 +02:00
} 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;
}
}
}
2022-10-04 17:58:52 +02:00
}
return 0;
}