Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp20
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int[,] numbers = {
- { 1, 2, 3 },
- { 4, 5, 6 },
- { 7, 8, 9 } };
- int correction = 1;
- int sum = 0;
- int multiplication = 1;
- int line = 2;
- int column = 1;
- for (int i = 0; i < numbers.GetLength(0); i++)
- {
- for (int j = 0; j < numbers.GetLength(1); j++)
- {
- Console.Write(numbers[i, j] + " ");
- }
- Console.WriteLine();
- }
- for (int i = 0; i < numbers.GetLength(0); i++)
- {
- for (int j = 0; j < numbers.GetLength(1); j++)
- {
- if (i == line - correction)
- {
- sum += numbers[i, j];
- }
- }
- }
- for (int i = 0; i < numbers.GetLength(0); i++)
- {
- for (int j = 0; j < numbers.GetLength(1); j++)
- {
- if (j == column - correction)
- {
- multiplication *= numbers[i, j];
- }
- }
- }
- Console.WriteLine($"Сумма {line} строки - {sum}, произведение {column} столбца - {multiplication}.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment