Advertisement
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 Homework20_2
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int composition = 1;
- int sum = 0;
- int indexSecondStringArray = 1;
- int indexFirstColumnArray = 0;
- int[,] array = new int[3, 4]
- {
- { 5, 2, 3, 4},
- { 2, 8, 4, 2},
- { 3, 5, 9, 1}
- };
- Console.WriteLine("Дан двумерный массив чисел:\n");
- 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(0); i++)
- {
- composition *= array[indexFirstColumnArray,i];
- }
- for( int j = 0; j < array.GetLength(1); j++)
- {
- sum += array[indexSecondStringArray,j];
- }
- Console.WriteLine($"\nСумма его второй строки равна : {sum}\n");
- Console.WriteLine($"Произведение его первого столбца равно: {composition}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement