Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         int numberOfMonths = int.Parse(Console.ReadLine());
  8.         int commissionInPercent = int.Parse(Console.ReadLine());
  9.         double rent = double.Parse(Console.ReadLine());
  10.  
  11.         double firstMonthRent = Math.Floor((double)numberOfMonths / 2) * rent;
  12.         double secondMonthRent = Math.Ceiling((double)numberOfMonths / 2) * rent * 4 / 5;
  13.         double commission = (firstMonthRent + secondMonthRent) * commissionInPercent / 100;
  14.         double grandTotal = firstMonthRent + secondMonthRent + commission;
  15.  
  16.         Console.WriteLine($"Total: {grandTotal:f2}");
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement