Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Zadacha1
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int broiAgenti = int.Parse(Console.ReadLine());
  10.             decimal obshto = 0;
  11.  
  12.             for (int i = 0; i < broiAgenti; i++)
  13.             {
  14.                 int broiSdelki = int.Parse(Console.ReadLine());
  15.  
  16.                 for (int j = 0; j < broiSdelki; j++)
  17.                 {
  18.                     decimal kvadratura = decimal.Parse(Console.ReadLine());
  19.                     decimal cena = decimal.Parse(Console.ReadLine());
  20.                     obshto = obshto + (kvadratura * cena);
  21.                 }
  22.             }
  23.  
  24.             decimal sredno = obshto / broiAgenti;
  25.             Console.WriteLine("{0:F3}",sredno);
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement