-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
72 lines (49 loc) · 1.37 KB
/
main.c
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
- KHALID SAQLAIN - 3CIN - 25/11/23 - VERIFICA - Quesito C -
*/
#include <stdio.h>
const int LEN = 10;
void fillMatrice(int matrice[LEN][LEN], int valore);
void printMatrice(int matrice[LEN][LEN]);
void diagonali(int matrice[LEN][LEN], int num);
void cornice(int matrice[LEN][LEN], int num);
int main() {
int matSK[LEN][LEN];
printf("SAQLAIN KHALID\n");
fillMatrice(matSK, 0);
diagonali(matSK, 29);
cornice(matSK, 5);
printMatrice(matSK);
return 0;
}
void fillMatrice(int matrice[LEN][LEN], int valore) {
for (int i = 0; i < LEN; i++) {
for (int j = 0; j < LEN; j++) {
matrice[i][j] = valore;
}
}
}
void diagonali(int matrice[LEN][LEN], int num) {
for (int i = 0; i < LEN; i++) {
matrice[i][i] = num;
matrice[i][LEN - 1 - i] = num;
}
}
void cornice(int matrice[LEN][LEN], int num) {
for (int i = 0; i < LEN; i++) {
matrice[i][0] = num;
matrice[i][LEN - 1] = num;
}
for (int i = 0; i < LEN; i++) {
matrice[0][i] = num;
matrice[LEN - 1][i] = num;
}
}
void printMatrice(int matrice[LEN][LEN]) {
for (int i = 0; i < LEN; i++) {
for (int j = 0; j < LEN; j++) {
printf("%2d ", matrice[i][j]);
}
printf("\n");
}
}