-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBCTlec19.c
81 lines (53 loc) · 1.58 KB
/
BCTlec19.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
//BCT Lecture 19
//2D-Array
// its Like a Matrix..
// Nested Loop needed..
// DataType ArrayName[row][column];
// Row jabe Dan(Right) e , Column Nambe Niche..
// Total Capacity of 2D Array = ( row x column )
// 1 0 0
// 0 1 0
// 0 0 1
// int matrixA [3][3];
// col=0 col=1 col=2 col=3
// 1 0 0 1 .....(Row 0)
// 0 1 0 1 .....(Row 1)
//int matrixB[2][4];
// int x[2][3] = {11,12,13,21,22,23};or {{11,12,13},{21,22,23}}
// printf("%d",x[1][2]); // output:23
//cl0 cl1 cl2
// 11 12 13...row 0
// 21 22 [23]...row 1
/*.....Traversing 2D Array....
int a[2][3]= {11,12,13,21,22,23};
for(i=0;i<2;i++){ //loop for Row
for(j=0;j<3;j++){ //loop for column
printf("%d\n",a[i][j]);
}
} */
#include<stdio.h>
int main(){
/* int x[2][3] = {11,12,13,
21,22,23};
printf("%d\n", x[1][2]);
printf("%d\n", x[0][0]);
int y = x[0][0] + x[1][1];
printf("value of y: %d\n", y); */
// problems..
int a[3][3],i,j,sum=0;
for(i=0;i<3;i++){
for(j=0;j<3;j++){
scanf("%d",&a[i][j]);
}
}
for(i=0;i<3;i++){
for(j=0;j<3;j++){
printf("%d ",a[i][j]);
sum = sum + a[i][j];
}
printf("\n");
}
float average = sum/9.0;
printf("Average is: %.2f",average);
return 0;
}