Advertisement
BojidarDosev

zadacha 3

Mar 8th, 2020
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.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,s = 0,max = 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.             //A
  25.             br = 0;
  26.             for (i = 0; i < 7; i++)
  27.                
  28.                 {
  29.  
  30.                 if (array[i, 0] > 0 && array[i, 1] > 0)
  31.                     br++;
  32.                 }
  33.             Console.WriteLine("broqt na usporednicite  " + br);
  34.             //C
  35.             br = 0;
  36.             for (i = 0; i < 7; i++)
  37.                
  38.                 {
  39.                    
  40.                     if (array[i, 0] > 0 && array[i, 1] > 0)
  41.                         P = P + array[i, 0] + array[i, 1];
  42.                 }
  43.             Console.WriteLine("p =   " + P);
  44.             //B
  45.             br = 0;
  46.             for (i = 0; i < 7; i++)
  47.                
  48.                 {
  49.                 if (array[i, 0] > 0 && array[i, 1] > 0)
  50.                     Console.WriteLine(array[i, 0] * array[i, 1]);
  51.                        
  52.                 }
  53.             Console.WriteLine();
  54.             //d
  55.             br = 0;
  56.             for (i = 0; i < 7; i++)
  57.             {
  58.                 if (array[i, 0] == array[i, 1] && array[i, 1] > 0) br++;
  59.             }
  60.             Console.WriteLine("vs kvadrati/rombove: " + br);
  61.             //e
  62.             br = 0;
  63.             for (i = 0; i < 7; i++)
  64.             {
  65.                 if (array[i, 0] > 0 && array[i, 1] > 0 && array[i, 0] != array[i, 1])
  66.                     if (array[i, 0] * array[i, 1] > max)
  67.                     {
  68.                         max = array[i, 0] * array[i, 1];
  69.                         br = i;
  70.                     }
  71.             }
  72.             Console.WriteLine("nai golqmoto lice e " + max + " a = " + array[br, 0] + " b = " + array[br, 1]);
  73.         }
  74.     }
  75. }
  76. /*
  77. 0
  78. 0
  79. -4
  80. -1
  81. 1
  82. 1
  83. 10
  84. 5
  85. 11
  86. 11
  87. 3
  88. 2
  89. 1
  90. 4
  91.  
  92.  */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement