Advertisement
BojidarDosev

zadacha 3

Feb 23rd, 2020
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.55 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp21
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int sum = 0;
  14.             int c = 0;
  15.             int[,] array = new int[3, 3];
  16.             for (int i = 0; i < 3; i++)
  17.                 for (int j = 0; j < 3; j++)
  18.                     array[i, j] = int.Parse(Console.ReadLine());
  19.             Console.WriteLine("array is ");
  20.             for (int i = 0; i < 3; i++)
  21.             {
  22.                 for (int j = 0; j < 3; j++)
  23.                     Console.Write(array[i, j] + " ");
  24.                 Console.WriteLine();
  25.             }
  26.             //a
  27.             Console.WriteLine();
  28.             for (int i = 0; i < 3; i++)
  29.             {
  30.                 c = array[i, 0];
  31.                 array[i, 0] = array[i, 2];
  32.                 array[i, 2] = c;
  33.             }
  34.             Console.WriteLine("array 2 is ");
  35.             for( int i = 0; i < 3; i++)
  36.             {
  37.                 for (int j = 0; j < 3; j++)
  38.                     Console.Write(array[i, j] + " ");
  39.                 Console.WriteLine();
  40.  
  41.             }
  42.  
  43.             for (int i = 0; i < 3; i++)
  44.             {
  45.                 sum = 0;
  46.                 for (int j = 0; j < 3; j++)
  47.                 {
  48.                     sum = array[j, i] + sum;
  49.  
  50.                 }
  51.                
  52.                 Console.WriteLine("sumata e " + sum);
  53.             }
  54.         }
  55.     }
  56. }
  57. //1
  58. //2
  59. //3
  60. //4
  61. //5
  62. //6
  63. //7
  64. //8
  65. //9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement