52 lines
768 B
C
52 lines
768 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int main(void){
|
||
|
char x;
|
||
|
int y;
|
||
|
int i;
|
||
|
int j;
|
||
|
int maxj=1;
|
||
|
printf("____________\n t) triangle\n c) Carre\nq) Quitter\nVotre choix ? :");
|
||
|
scanf("%c",&x);
|
||
|
if(x=='t'){
|
||
|
printf("Hauteur ?: ");
|
||
|
getchar();
|
||
|
scanf("%d",&y);
|
||
|
for(i=1;i<=y;i++){
|
||
|
for(j=1;j<=maxj;j++){
|
||
|
printf("*");
|
||
|
}
|
||
|
printf("\n");
|
||
|
maxj+=1;
|
||
|
}
|
||
|
}
|
||
|
else{
|
||
|
if(x=='c'){
|
||
|
printf("Hauteur ?: ");
|
||
|
getchar();
|
||
|
scanf("%d",&y);
|
||
|
for(i=1;i<=y;i++){
|
||
|
if((i==1)||(i==y)){
|
||
|
for(j=1;j<=y;j++){
|
||
|
printf("*");
|
||
|
}
|
||
|
}
|
||
|
else{
|
||
|
printf("*");
|
||
|
for(j=1;j<y-1;j++){
|
||
|
printf(" ");
|
||
|
}
|
||
|
printf("*");
|
||
|
}
|
||
|
printf("\n");
|
||
|
}
|
||
|
}
|
||
|
else{
|
||
|
if(x=='q'){
|
||
|
printf("Aurevoir...");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|