Add matrice unitaire

This commit is contained in:
flyingscorpio@pinebookpro 2021-11-02 14:32:23 +01:00
parent 0f3fa8d027
commit d1e8c0e3db
2 changed files with 25 additions and 0 deletions

1
.gitignore vendored
View file

@ -25,3 +25,4 @@ calculatrice
affichage-tableaux
min-max-moy
lettre-perdue
matrice-unitaire

View file

@ -0,0 +1,24 @@
/* Matrice unitaire */
#include <stdio.h>
#include <stdlib.h>
#define DIMENSION 4
int main() {
int matrice[DIMENSION][DIMENSION];
for (int i = 0; i < DIMENSION; i++) {
for (int j = 0; j < DIMENSION; j++) {
if (i == j) matrice[i][j] = 1;
else matrice[i][j] = 0;
printf("%d ", matrice[i][j]);
}
printf("\n");
}
return 0;
}