Advertisement
martinhadzhiev

Untitled

Aug 22nd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. namespace Bills
  2. {
  3.     using System;
  4.  
  5.     class Bills
  6.     {
  7.         static void Main()
  8.         {
  9.             int months = int.Parse(Console.ReadLine());
  10.  
  11.             double electricitySum = 0;
  12.  
  13.             for (int i = 0; i < months; i++)
  14.             {
  15.                 double electricityBill = double.Parse(Console.ReadLine());
  16.                 electricitySum += electricityBill;
  17.             }
  18.  
  19.             double water = months * 20;
  20.             double internet = months * 15;
  21.             double otherBills = (electricitySum + water + internet) * 1.2;
  22.  
  23.             double average = (electricitySum + water + internet + otherBills) / months;
  24.  
  25.             Console.WriteLine($"Electricity: {electricitySum:f2} lv");
  26.             Console.WriteLine($"Water: {water:f2} lv");
  27.             Console.WriteLine($"Internet: {internet:F2} lv");
  28.             Console.WriteLine($"Other: {otherBills:f2} lv");
  29.             Console.WriteLine($"Average: {average:f2} lv");
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement