Guest User

Untitled

a guest
Nov 24th, 2017
1,160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04_Problem
  4. {
  5. public class Bills
  6. {
  7. public static void Main()
  8. {
  9. int months = int.Parse(Console.ReadLine());
  10.  
  11. const double waterBill = 20;
  12. const double internetBill = 15;
  13. double otherBills = 0;
  14.  
  15. double waterBillCnt = 0;
  16. double internetBillCnt = 0;
  17. double electricityBillCnt = 0;
  18. double otherBillsCnt = 0;
  19.  
  20. for (int i = 1; i <= months; i++)
  21. {
  22. double electricityBill = double.Parse(Console.ReadLine());
  23.  
  24. electricityBillCnt += electricityBill;
  25. waterBillCnt += waterBill;
  26. internetBillCnt += internetBill;
  27. otherBills = (electricityBill + waterBill + internetBill) * 1.2;
  28. otherBillsCnt += otherBills;
  29. }
  30. double avg = (electricityBillCnt+waterBillCnt+internetBillCnt+otherBillsCnt)/ months;
  31. Console.WriteLine("Electricity: {0:f2} lv",electricityBillCnt);
  32. Console.WriteLine("Water: {0:f2} lv", waterBillCnt);
  33. Console.WriteLine("Internet: {0:f2} lv", internetBillCnt);
  34. Console.WriteLine("Other: {0:f2} lv", otherBillsCnt);
  35. Console.WriteLine("Average: {0:f2} lv", avg);
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment