Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CharityMarathon
- {
- class Program
- {
- static void Main(string[] args)
- {
- decimal days = decimal.Parse(Console.ReadLine());
- decimal runners = decimal.Parse(Console.ReadLine());
- decimal averageLapsPerRunner = decimal.Parse(Console.ReadLine());
- decimal lenghtOfTheTrack = decimal.Parse(Console.ReadLine());
- decimal capacityOfTheTrack = decimal.Parse(Console.ReadLine());
- decimal moneyDonatedPerKilometer = decimal.Parse(Console.ReadLine());
- decimal capacityOfTheTrackCalculation = capacityOfTheTrack * days;
- if (capacityOfTheTrackCalculation < runners)
- {
- runners = capacityOfTheTrack;
- }
- decimal totalMeters = runners * averageLapsPerRunner * lenghtOfTheTrack;
- decimal totalKilometers = totalMeters / 1000.0m;
- decimal moneyRaisedForTheMarathon = totalKilometers * moneyDonatedPerKilometer;
- Console.WriteLine($"Money raised: {moneyRaisedForTheMarathon:f2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment