Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Работа_с_конкретными_строками_столбцами
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int sum = 0;
- int product = 1;
- int lineIndex = 1;
- int columnIndex = 0;
- string outputSecondLine = "второй строки";
- string outputFirstColumn = "первого столбца";
- int[,] array =
- {
- { 1, 2, 3, },
- { 4, 5, 6, },
- { 7, 8, 9, }
- };
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine();
- }
- for (int i = 0; i < array.GetLength(1); i++)
- {
- sum += array[lineIndex, i];
- }
- for (int i = 0; i < array.GetLength(0); i++)
- {
- product *= array[i, columnIndex];
- }
- Console.WriteLine($"\nСумма {outputSecondLine}: {sum}");
- Console.WriteLine($"Произведение {outputFirstColumn}: {product}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement