-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathL4Q2.c
81 lines (65 loc) · 1.43 KB
/
L4Q2.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
70
71
72
73
74
75
76
77
78
79
80
81
#include<stdio.h>
void ler_matriz(int n, int m, int notas[][m])
{
int i, j;
for (i = 0; i < n; i++)
{
for (j = 0; j < m; j++)
{
// printf(">>>> i = %d, j = %d\n", i, j);
scanf("%d", ¬as[i][j]);
}
}
}
/*
void imprimir_linha(int i, int j, int m, float notas[][m])
{
if (j < m)
{
char c = (j == m - 1) ? '\n' : '\t';
printf("%f%c", notas[i][j], c);
/*if (j == m - 1)
{
printf("%f\n", notas[i][j]);
}
else
{
printf("%f\t", notas[i][j]);
}
imprimir_linha(i, j + 1, m, notas);
}
} */
void imprimir_matriz(int n, int m, int matriz1[][m], int matriz2[][m])
{
int j, i;
/*if (i < n)
{
imprimir_linha(i, 0, m, notas);
imprimir_matriz(i + 1, n, m, notas);
} */
for (i = 0; i < n; i ++)
{
for (j = 0; j < m; j ++)
{
printf("%d\n", matriz1[i][j]+matriz2[i][j]);
}
}
}
int main()
{
int n;
scanf ("%d", &n);
if (n == 0)
{
printf ("Vazia\n");
}
else
{
int matriz1[n][n];
int matriz2[n][n];
ler_matriz(n, n, matriz1);
ler_matriz(n, n, matriz2);
imprimir_matriz(n, n, matriz1, matriz2);
}
return 0;
}