Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp15.WorkArray
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] array = new int[5, 5];
- Random rand = new Random();
- int sum2Row = 0;
- int composition = 1;
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- array[i, j] = rand.Next(0, 10);
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine();
- }
- for (int i = 0; i < array.GetLength(1); i++)
- {
- sum2Row += array[1, i];
- }
- Console.WriteLine($"Сумма второй строки: {sum2Row}.");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- composition *= array[i, 0];
- }
- Console.WriteLine($"Произведение первого столбца: {composition}.");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement