FSHY include stdafx include iostream include conio using namespace std

 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
// FSHY
//
#include "stdafx.h"
#include <iostream>
#include <conio.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
const int n = 2, m = 3;
int B[n][m], D[m];
cout << "Enter array: ";
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
{
cout << "\n[" << i << "][" << j << "]: ";
cin >> B[i][j];
}
cout << endl;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cout << "[" << B[i][j] << "]";
}
cout << endl;
}
for (int i = 0; i < m; i++)
{
D[i] = 0;
for (int j = 0; j < n; j++)
{
D[i] += B[j][i];
}
}
cout << "\nResult: ";
for (int i = 0; i < m; i++)
cout << D[i] << " ";
_getch();
return 0;
}