Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _3._3
- {
- class Program
- {
- static void Main(string[] args)
- {
- int userValue;
- Console.CursorVisible = false;
- int[,] intArray = {
- { 0, 0, 0 },
- { 0, 0, 0 },
- { 0, 0, 0 }
- };
- int sum = 0;
- int product = 1;
- Console.WriteLine("Нужно составить матрицу A(3,3)");
- for (int i = 0; i < intArray.GetLength(0); i++)
- {
- Console.WriteLine("Введите число: ");
- userValue = Convert.ToInt32(Console.ReadLine());
- intArray[i, 0] = userValue;
- Console.Clear();
- for (int j = 0; j < intArray.GetLength(1); j++)
- {
- Console.WriteLine("Введите число: ");
- userValue = Convert.ToInt32(Console.ReadLine());
- intArray[i, j] = userValue;
- Console.Clear();
- }
- }
- for (int i = 0; i < intArray.GetLength(0); i++)
- {
- for (int j = 0; j < intArray.GetLength(1); j++)
- {
- Console.Write(intArray[i, j] + " ");
- }
- Console.WriteLine();
- }
- for (int i = 0; i < intArray.GetLength(0); i++)
- {
- product *= intArray[i, 0];
- }
- for (int i = 0; i < intArray.GetLength(1); i++)
- {
- sum += intArray[1, i];
- }
- Console.WriteLine("Сумма второй строки: "+ sum);
- Console.WriteLine("Произведение первого столбца: " + product);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement