-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdec6.cpp
More file actions
50 lines (40 loc) · 1003 Bytes
/
dec6.cpp
File metadata and controls
50 lines (40 loc) · 1003 Bytes
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
/*#include <iostream>
using namespace std;
int main()
{
const int ROW = 2, COLOMN = 3;
int total = 0;
int array[ROW][COLOMN] = {{1,2,3},{1,2,3}};
for(int row = 0; row < ROW; row++)
{
for(int colomn = 0; colomn < COLOMN; colomn++)
{
// cout << array[row][colomn] << " ";
total += array[row][colomn];
}
cout << endl;
}
cout << total << endl;
}*/
#include <iostream>
using namespace std;
void calculateTotal(int array[][col], int size);
int main()
{
const int ROW = 2, COLOMN = 3;
int array[ROW][COLOMN] = {{1,2,3},{1,2,3}};
calculateTotal(array, COLOMN);
}
void calculateTotal(int array[][COL], int size)
{
int total = 0;
for(int row = 0; row < size; row++)
{
for(int colomn = 0; colomn < colomn; colomn++)
{
// cout << array[row][colomn] << " ";
total += array[row][colomn];
}
}
cout << total<< endl;
}