Answer the question
In order to leave comments, you need to log in
How to make it not touch the main diagonal?
#include <iostream>
using namespace std;
int main() {
setlocale(LC_ALL, "RUS");
int i, j, N, M;
double S, a[5][5];
cout << "N=";
cin >> N;
cout << "M=";
cin >> M;
cout << "Введите матрицу А \n";
for (i = 0; i < N; i++)
for (j = 0; j < M; j++)
cin >> a[i][j];
for (i = 0; i < N; a[i][0] = S / M, i++)
for (S = j = 0; j < M; j++)
S += a[i][j];
cout << "выход матрицы A" << endl;
for (i = 0; i < N; cout << endl, i++)
for (j = 0; j < M; j++)
cout << a[i][j] << endl;
system("pause");
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question