Advertisement
NelIfandieva

Pr04_SemeenBudget

Dec 18th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.35 KB | None | 0 0
  1. namespace claswork
  2. {
  3.     using System;
  4.     class ProgramForCalculatingFans
  5.     {
  6.         public static void Main()
  7.         {
  8.             int monthsNum = int.Parse(Console.ReadLine());
  9.             const double waterBillPerMonth = 20;
  10.             const double netBillPerMonth = 15;
  11.             double electricityForAllMonths = 0;
  12.             double drugiForALlMonths = 0;
  13.             double totalForPeriod = 0;
  14.  
  15.             for (int i = 1; i <= monthsNum; i++)
  16.             {
  17.                 double electricityBill = double.Parse(Console.ReadLine());
  18.                 electricityForAllMonths = electricityForAllMonths + electricityBill;
  19.                 double drugiZaMeseca = (waterBillPerMonth + netBillPerMonth + electricityBill) + ((waterBillPerMonth + netBillPerMonth + electricityBill) * 0.2);
  20.                 drugiForALlMonths += drugiZaMeseca;
  21.                 totalForPeriod += waterBillPerMonth + netBillPerMonth + electricityBill + drugiZaMeseca;
  22.             }
  23.  
  24.             Console.WriteLine("Tok: {0:f2}", electricityForAllMonths);
  25.             Console.WriteLine("Water: {0:f2}", waterBillPerMonth * monthsNum);
  26.             Console.WriteLine("Net: {0:f2}", netBillPerMonth * monthsNum);
  27.             Console.WriteLine("Drugi: {0:f2}", drugiForALlMonths);
  28.             Console.WriteLine("Average: {0:f2}", totalForPeriod / monthsNum);
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement