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 Task20
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Random random = new Random();
- int column = 1;
- int line = 2;
- int translationForComputer = 1;
- int minValue = 0;
- int maxValue = 10;
- int sumHorizontal = 0;
- int workVertical = 1;
- int[,] array = new int[random.Next(minValue,maxValue), random.Next(minValue, maxValue)];
- for (int i = minValue; i < array.GetLength(0); i++)
- {
- for (int j = minValue; j < array.GetLength(1); j++)
- {
- array[i, j] = random.Next(minValue, maxValue);
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine(" ");
- }
- for (int i = minValue; i < array.GetLength(0); i++)
- {
- for (int j = minValue; j < array.GetLength(1); j++)
- {
- if (i == (line - translationForComputer))
- {
- sumHorizontal += array[i,j];
- }
- }
- }
- for (int i = minValue; i < array.GetLength(0); i++)
- {
- for (int j = minValue; j < array.GetLength(1); j++)
- {
- if (j == (column - translationForComputer) && array[i,j] != minValue)
- {
- workVertical *= array[i, j];
- }
- }
- }
- Console.WriteLine("\nCумма строки равна: " + sumHorizontal + "\n\nПроизведение столбца равно: " + workVertical);
- }
- }
- }
Add Comment
Please, Sign In to add comment