Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Matrix_Calculations
- {
- class Program
- {
- private const string
- Matrix = "Матрица: ",
- Sum = "Сумма второй строки: ",
- Composition = "Произвидение первого столбца: ",
- EmptySpace = " ";
- private const int
- Min = 1, Max = 20, MatrixSize = 3;
- static void Main(string[] args)
- {
- int[,] matrix = new int[MatrixSize, MatrixSize];
- int sum = 0, composition = 1;
- Random random = new Random();
- Console.WriteLine(Matrix);
- for (int i = 0; i < MatrixSize; i++)
- {
- for (int j = 0; j < MatrixSize; j++)
- {
- matrix[i, j] = random.Next(Min, Max);
- Console.Write(matrix[i, j] + EmptySpace);
- if (i == 1)
- {
- sum += matrix[i, j];
- }
- if (j == 0)
- {
- composition *= matrix[i, j];
- }
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- Console.WriteLine(Sum + sum);
- Console.WriteLine(Composition + composition);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment