Aliendreamer

bills issue4.19.03.2017

Mar 19th, 2017
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 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 issue4._19bills
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             int months = int.Parse(Console.ReadLine());
  15.  
  16.  
  17.             decimal totalElectro = 0;
  18.  
  19.             for(int i=0;i<months;i++)
  20.             {
  21.  
  22.                 decimal ElectroBill = decimal.Parse(Console.ReadLine());
  23.                 totalElectro += ElectroBill;
  24.             }
  25.  
  26.             decimal waterBill = 20.00m * months;
  27.             decimal netBill = 15.00m * months;
  28.             decimal othersBill = (totalElectro + waterBill + netBill) + ((totalElectro + waterBill + netBill) * 0.20m);
  29.             decimal totalBill = totalElectro + waterBill + netBill + othersBill;
  30.             decimal averageBill = totalBill / months;
  31.  
  32.             Console.WriteLine($"Electricity: {totalElectro} lv.");
  33.             Console.WriteLine("Water: {0:f2}", waterBill);
  34.             Console.WriteLine("Internet: {0:f2}",netBill); ;
  35.             Console.WriteLine("others: {0:f2}", othersBill);
  36.            Console.WriteLine("Average: {0:f2}",averageBill);
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment