Var matrix: array[1..5,1..5] of integer; i, j: integer; sg:=0; sp:=0;begin writeln ('Введите 25 чисел: '); for i := 1 to 5 do for j := 1 to 5 do read (matrix[i,j]); for i := 1 to 5 do begin for j := 1 to 5 do write (matrix[i,j], ' '); writeln end; for i:=1 to 5 do begin for j:= 1 to 5 do if j=i then sg:=sg+matrix[i,j]; end; for i:=5 downto 1 do begin for j:=1to 5 do if (i+j)=6 then sp:=sp+matrix[i,j] end; sp:=sp-matrix[3,3];1 writeln(sg,' ',sp);readlnend
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace СиШарп
{
class Program
{
static void Main(string[] args)
{
Console.Write("m = ");
int m = int.Parse(Console.ReadLine());
Console.Write("n = ");
int n = int.Parse(Console.ReadLine());
Console.WriteLine("A({0},{1}):",m,n);
int[,] A = new int[m,n];
Random rand = new Random();
double S = 0;
for(int i = 0; i < m; i++)
{
for(int j = 0; j < n; j++)
{
A[i, j] = rand.Next(-10, 10);
Console.Write("{0,3} ",A[i,j]);
if (A[i, j] % 2 == 0) S += A[i, j];
}
Console.WriteLine();
}
Console.WriteLine("S = {0}",S);
Console.ReadKey();
}
}
}