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