Advertisement
BojidarDosev

zadacha 1 23.02.2020.

Feb 22nd, 2020
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.45 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 ConsoleApp3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int br = 0;
  14.             int i, j, vs;
  15.             int[,] array = new int[4, 4];
  16.             for (i = 0; i < 4; i++)
  17.                 for (j = 0; j < 4; j++)
  18.                     array[i, j] = int.Parse(Console.ReadLine());
  19.             for (i = 0; i < 4; i++)
  20.             //1
  21.             {
  22.                 for (j = 0; j < 4; j++)
  23.                     Console.Write(array[i, j] + " ");
  24.                 Console.WriteLine();
  25.             }
  26.             //2
  27.             for (i = 0; i < 4; i++)
  28.             {
  29.                 for (j = 0; j < 4; j++)
  30.                 {
  31.                     if (array[i, j] % 2 == 0)
  32.                         br++;
  33.                 }
  34.             }
  35.             Console.WriteLine("broqt na chetnite e " + br);
  36.             //3
  37.             for (i = 0; i < 4; i++)
  38.             {
  39.                 for (j = 0; j < 4; j++)
  40.                 {
  41.                     if (array[i, j] > -5 && array[i, j] < 12)
  42.                         Console.Write(array[i, j] + " ");
  43.                 }
  44.             }
  45.             Console.WriteLine("diagonal2: ");
  46.             //4
  47.             for (i = 0; i < 4; i++)
  48.             {
  49.                     Console.Write( array[i, 3 - i] + " ");
  50.             }
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement