Advertisement
Guest User

Untitled

a guest
Mar 6th, 2018
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace expenses
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var n = int.Parse(Console.ReadLine());
  14. double Electricity = 0;
  15. double Water = 0;
  16. double Internet = 0;
  17. double Other = 0;
  18. double Average = 0;
  19. double months = 0;
  20. for (int i = 0; i < n; i++)
  21. {
  22. months = double.Parse(Console.ReadLine());
  23. Electricity++;
  24.  
  25.  
  26. }
  27. Electricity = Electricity + Electricity;
  28. //Console.WriteLine(Electricity);
  29. Water = months * 20;
  30. Internet = months * 15;
  31. Other = (Electricity + 20 + 15) * 1.20;
  32. Average = (Electricity + Water + Other) / months;
  33. Console.WriteLine($"Electricity:{Electricity:f2}");
  34. Console.WriteLine($"Water:{Water:f2}");
  35. Console.WriteLine($"Internet:{Internet:f2}");
  36. Console.WriteLine($"Average{Average:f2}");
  37.  
  38.  
  39.  
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement