APL/APL1.1/TP07/table_3.c

34 lines
692 B
C
Raw Normal View History

2021-09-28 15:59:07 +02:00
#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;
}