Advertisement
bacco

charityMarathon

Jun 25th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2.  
  3. public class Example
  4. {
  5.     public static void Main()
  6.     {
  7.         var daysMarathon  = long.Parse(Console.ReadLine()); //
  8.         var runners       = long.Parse(Console.ReadLine()); //
  9.         var AverageTracks = long.Parse(Console.ReadLine());
  10.         var LenghtTrack   = long.Parse(Console.ReadLine());
  11.         var capacityTrack = long.Parse(Console.ReadLine()); //
  12.         var moneyPerKm    = double.Parse(Console.ReadLine());
  13.  
  14.         var participants = runners;
  15.         capacityTrack *= days;
  16.  
  17.         if (participants >= capacityTrack )
  18.         {
  19.             participants = capacityTrack ;
  20.         }
  21.  
  22.         var profit = participants * AverageTracks * LenghtTrack / 1000 * moneyPerKm;
  23.  
  24.         Console.WriteLine($"Money raised: {profit:F2}");
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement