APL/APL1.1/TP07/table_3.c

34 lines
692 B
C

#include<stdio.h>
#include<stdlib.h>
#define TABLE_WIDTH 15
#define TABLE_HEIGHT 15
int main(int argc, char * argv[]) {
//En-tête de la table sur toute la ligne.
printf(" X | ");
for (int col = 0; col <= TABLE_WIDTH; col++) {
printf(" %3d ", col);
}
printf("\n");
//Séparation de la table sur toute la ligne.
printf("-----+");
for (int col = 0; col <= TABLE_WIDTH; col++) {
printf("-----", col);
}
printf("\n");
//Affichage de la table de multiplication + en-tête
for (int lin = 0; lin <= TABLE_HEIGHT; lin++) {
printf(" %3d | ", lin);
for (int col = 0; col <= TABLE_WIDTH; col++) {
printf(" %3d ", lin * col);
}
printf("\n");
}
return EXIT_SUCCESS;
}