-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimprimir_matriz.c
58 lines (47 loc) · 934 Bytes
/
imprimir_matriz.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
#include<stdio.h>
void ler_linha(int i, int j, int m, float notas[][m])
{
if (j < m)
{
scanf("%f", ¬as[i][j]);
ler_linha(i, j + 1, m, notas);
}
}
void ler_matriz(int i, int n, int m, float notas[][m])
{
if (i < n)
{
ler_linha(i, 0, m, notas);
ler_matriz(i + 1, n, m, notas);
}
}
void imprimir_linha(int i, int j, int m, float notas[][m])
{
if (j < m)
{
if (j == m-1)
{
printf("%f\n", ¬as[i][j]);
}
else
{
printf("%f\t", ¬as[i][j]);
}
ler_linha(i, j + 1, m, notas);
}
}
void imprimir_matriz(int i, int n, int m, float notas[][m])
{
if (i < n)
{
imprimir_linha(i, 0, m, notas);
imprimir_matriz(i + 1, n, m, notas);
}
}
int main()
{
float notas[5][4];
ler_matriz(0, 5, 4, notas);
imprimir_matriz(0, 5, 4, notas);
return 0;
}