что-то типа этого:
const n = 8, m = 8;
var
A: array[1..n,1..m] of integer;
i, j, sum, product: integer;
isnotnull: boolean;
begin
randomize;
writeln('Случайная матрица:'); for i:=1 to n do begin
for j:=1 to m do begin
A[i,j] := random(51) - 25;
write(A[i,j]:5);
end;
writeln;
end; sum := 0;
for i:=1 to n do
if A[i,n-i+1] < 0 then
sum := sum + A[i,n-i+1];
writeln('Сумма отрицательных элементов побочной диагонали = ', sum); product := 1;
isnotnull := False;
for i:=1 to n-1 do
for j:=2 to n do
if (j > i) and (A[i,j] <> 0) then begin
isnotnull := True;
product := product * A[i,j];
end;
if isnotnull
writeln('Произведение ненулевых элементов в области выше главной диагонали = ', product)
else
writeln('Ненулевых элементов в области выше главной диагонали нет.', product); readln;
end.
На C++
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
#include <cstdlib>
using std::rand;
using std::srand;
#include <ctime>
using std::time;
int main()
{
int B[4][5];
int sum[5] = { 0 };
long product = 1;
srand(time(0));
//Инициализировать массива значениями от 0 до 9 и вывести таблицу на экран
for(int i = 0; i < 4; i++)
{
for(int j = 0; j < 5; j++)
{
B[i][j] = rand() % 10;
cout << B[i][j] << ' ';
}
cout << endl;
}
cout << endl;
//Записать в одномерный массив сумму эллементов столбца
for(int i = 0; i < 5; i++)
{
for(int j = 0; j < 4; j++)
{
sum[i] += B[j][i];
}
}
//Вывести на экран значения одномерного массива
for(int i = 0; i < 5; i++)
{
cout << sum[i] << ' ';
}
//Вычесление произведения(умножения)
for(int i = 0; i < 5; i++)
{
product *= sum[i];
}
cout << "\n\nProduct = " << product << endl;
cin.get();
return 0;
}