1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| #include <stdio.h>
#include <stdlib.h>
#define TAILLE 6
int main(void)
{
static int tableau[TAILLE][TAILLE] = {0};
int i = 0;
int j = 0;
char c = 'a';
//contour et intérieur à 1
for(i=0; i< TAILLE; i++) {
tableau[i][TAILLE-1] = 1;
tableau[TAILLE-1][i] = 1;
tableau[0][i] = 1;
tableau[i][0] = 1;
tableau[i][TAILLE-1-i] = 1;
}
for(j=0; j<TAILLE; j++) {
for(i=0; i<TAILLE; i++) {
if(tableau[i][j] == 1)
printf("%c ", c);
else
printf(" ");
}
printf("\n");
}
return EXIT_SUCCESS;
} |
Partager