Benjail

3.3

Aug 29th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. using System;
  2.  
  3. namespace IMJunior
  4. {
  5.     class Program
  6.     {
  7.        
  8.         static void Main(string[] args)
  9.         {
  10.             int summ2 = 0;
  11.             int proizv1 = 1;
  12.             int[,] A = { { 1, 2, 3 },
  13.                          { 4, 5, 6 },
  14.                          { 7, 8, 9 } };
  15.             for (int i = 0; i < 3; i++)
  16.             {
  17.                 for (int j = 0; j < 3; j++)
  18.                 {
  19.                     Console.Write(A[i, j] + " ");
  20.                     if (i == 1)  
  21.                     {
  22.                         summ2 += A[i, j];      
  23.                     }  
  24.                     if (j == 0)
  25.                     {
  26.                         proizv1 =proizv1* A[i, j];
  27.                     }
  28.                 }
  29.                 Console.WriteLine();
  30.             }            
  31.             Console.WriteLine("Сумма второй строки равна: "+summ2);    
  32.             Console.WriteLine("Произведение первого столбца равно: " + proizv1);    
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment