50 lines
950 B
C
50 lines
950 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
int main(void) {
|
||
|
int i;
|
||
|
int j;
|
||
|
int n;
|
||
|
char ch;
|
||
|
while(ch != 'q'){
|
||
|
printf(" t) Triangle\n c) Carre\n q) Quitter\n ");
|
||
|
printf("Votre choix ?\n");
|
||
|
ch = getchar();
|
||
|
if(ch == 't'){
|
||
|
printf("choisissez la hauteur : ");
|
||
|
scanf("%d",&n);
|
||
|
for(i=0;i<n;i++){
|
||
|
for(j=0;j<n;j++){
|
||
|
if(i>j){
|
||
|
printf("*");
|
||
|
}
|
||
|
else{
|
||
|
printf(" ");
|
||
|
}
|
||
|
}
|
||
|
printf("\n");
|
||
|
}
|
||
|
}
|
||
|
if(ch =='c'){
|
||
|
printf("choisissez la hauteur : ");
|
||
|
scanf("%d",&n);
|
||
|
for(i=0;i<n;i++){
|
||
|
for(j=0;j<n;j++){
|
||
|
if(i==0 || i == n-1){
|
||
|
printf("*");
|
||
|
}else{
|
||
|
if(j==0 || j==n-1){
|
||
|
printf("*");
|
||
|
}else{
|
||
|
printf(" ");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
printf("\n");
|
||
|
}
|
||
|
}
|
||
|
if(ch == 'q'){
|
||
|
printf("Au revoir...\n");
|
||
|
}
|
||
|
}
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|