Advertisement
spasnikolov131

Untitled

Jun 21st, 2021
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Bills
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int months = int.Parse(Console.ReadLine());
  10. double electricityBills = 0;
  11. double waterBills = 0;
  12. double internetBills = 0;
  13. double othersBills = 0;
  14. double water = 20;
  15. double internet = 15;
  16. double otherBill = 0;
  17.  
  18. for (int i = 1; i <= months; i++)
  19. {
  20. double electricityBill = double.Parse(Console.ReadLine());
  21. electricityBills += electricityBill;
  22. waterBills = months * water;
  23. internetBills = months * internet;
  24. othersBills = (electricityBill + water + internet) + ((electricityBill + water + internet) * 0.2);
  25. otherBill =+ othersBills;
  26. }
  27. double average = (electricityBills + waterBills + internetBills + othersBills) / months;
  28. Console.WriteLine($"Electricity: {electricityBills:f2} lv");
  29. Console.WriteLine($"Water: {waterBills:f2} lv");
  30. Console.WriteLine($"Internet: {internetBills:f2} lv");
  31. Console.WriteLine($"Other: {othersBills:f2} lv");
  32. Console.WriteLine($"Average: {average:f2} lv");
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement