Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace midprepare
- {
- class Program
- {
- static void Main(string[] args)
- {
- int daysOfPlunder = int.Parse(Console.ReadLine());
- decimal dailyPlunder = decimal.Parse(Console.ReadLine());
- decimal expectedPlunder = decimal.Parse(Console.ReadLine());
- decimal totallPlunder = 0.0m;
- for (int i = 1; i <= daysOfPlunder; i++)
- {
- totallPlunder+=dailyPlunder;
- if (i % 3 == 0 && i != 0)
- {
- totallPlunder += dailyPlunder * 0.5m;
- }
- if (i % 5 == 0 && i!=0)
- {
- totallPlunder -= totallPlunder * 0.3m;
- }
- }
- if (totallPlunder >= expectedPlunder)
- {
- Console.WriteLine($"Ahoy! {totallPlunder:f2} plunder gained.");
- }
- else
- {
- decimal percent = (((expectedPlunder - totallPlunder)/expectedPlunder) * 100);
- Console.WriteLine($"Collected only {(100-percent):f2}% of the plunder.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement