BojidarDosev

задача 3 // 6.3.2020

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