Last active
May 16, 2023 16:45
-
-
Save Strelok78/289e6bb16e6eb5092d7f997481f41098 to your computer and use it in GitHub Desktop.
There is a two-dimensional array. The sum of the second row and the product of the first column are calculated. The initial matrix and calculation results are displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| internal class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| int[,] arrayNumbers = | |
| { | |
| {1, 2, 3}, | |
| {4, 5, 6}, | |
| }; | |
| int sum = 0; | |
| int multiply = 1; | |
| int column1 = 0; | |
| int line2 = 1; | |
| for (int i = 0; i < arrayNumbers.GetLength(0); i++) | |
| { | |
| for (int j = 0; j < arrayNumbers.GetLength(1); j++) | |
| { | |
| Console.Write(arrayNumbers[i, j] + " "); | |
| } | |
| Console.WriteLine(); | |
| } | |
| for (int i = 0; i < arrayNumbers.GetLength(0); i++) | |
| { | |
| multiply *= arrayNumbers[i, column1]; | |
| } | |
| for (int i = 0; i < arrayNumbers.GetLength(1); i++) | |
| { | |
| sum += arrayNumbers[line2, i]; | |
| } | |
| Console.WriteLine($"fist column multiply = {multiply} and second line sum = {sum}"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment