Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CSLight
- {
- public class Program
- {
- static void Main(string[] args)
- {
- int[,] numbers =
- {
- {1,1,1,1 },
- {2,2,2,2 },
- {3,3,3,3 }
- };
- int lineIndex1 = 0;
- int lineIndex2 = 1;
- int sum = 0;
- int product = 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++)
- {
- product *= numbers[i, lineIndex1];
- }
- for (int i = 0; i < numbers.GetLength(1); i++)
- {
- sum += numbers[lineIndex2, i];
- }
- Console.WriteLine($"Сумма: {sum}");
- Console.WriteLine($"Произведение: {product}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement