Advertisement
BojidarDosev

zadacha 4

Mar 8th, 2020
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.64 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 ConsoleApp42
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double max = 0,sum = 0,av = 0;
  14.             int i, j, red = 0,br = 0;
  15.             double[,] array = new double[5, 4];
  16.             for (i = 0; i < 5; i++)
  17.                 for (j = 0; j < 4; j++)
  18.                     array[i, j] = double.Parse(Console.ReadLine());
  19.             for (i = 0; i < 5; i++)
  20.             {
  21.                 for (j = 0; j < 4; j++)
  22.                     Console.Write(array[i, j] + " ");
  23.                 Console.WriteLine();
  24.             }
  25.             for (i = 0; i < 5; i++)
  26.             {
  27.                 if (array[i, 0] > max)
  28.                 {
  29.                     max = array[i, 0];
  30.                     red = i;
  31.                 }
  32.             }
  33.             Console.WriteLine("max radius: " + max + " na red " + (red+1));
  34.             for (i = 0; i < 5; i++)
  35.             {
  36.                 sum = sum + array[i, 2];
  37.             }
  38.             Console.WriteLine("sumata ot licata : " + sum);
  39.             sum = 0;
  40.             for (i = 0; i < 5; i++)
  41.             {
  42.                 if (array[i, 0] > 0)
  43.                 {
  44.                     br++;
  45.                     sum = sum + array[i, 3];
  46.  
  47.                 }
  48.             }
  49.             av = sum / br;
  50.             Console.WriteLine("av na duljinite e: " + Math.Round(av, 2));
  51.  
  52.            
  53.  
  54.         }
  55.  
  56.     }
  57. }
  58. /*
  59.  1
  60.  2
  61.  3,14
  62.  6,28
  63.  3,5
  64.  7
  65.  38,47
  66.  21,98
  67.  4
  68.  8
  69.  50,24
  70.  25,12
  71.  0
  72.  0
  73.  0
  74.  0
  75.  2,2
  76.  4,4
  77.  15,20
  78.  13,82
  79.  */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement