Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace homework_03_3
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random random = new Random();
- int[,] matrix = new int[3, 3];
- int sum = 0;
- int product = 0;
- // fill the array random numbers
- for (int i = 0; i < matrix.GetLength(0); i++)
- {
- for (int j = 0; j < matrix.GetLength(1); j++)
- {
- matrix[i, j] = random.Next(0, 100);
- Console.Write(matrix[i, j] + " ");
- if (matrix[i, j] / 10 <= 0) Console.Write(" ");
- }
- Console.WriteLine();
- }
- sum = matrix[1, 0] + matrix[1, 1] + matrix[1, 2];
- product = matrix[0, 0] * matrix[1, 0] * matrix[2, 0];
- Console.WriteLine("\nСумма второй строки: " + sum);
- Console.WriteLine("Произведение первого столбца: " + product);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement