Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace fundamental14
- {
- class MainClass
- {
- public static void Main()
- {
- int day = int.Parse(Console.ReadLine());
- double pirate = double.Parse(Console.ReadLine());
- double grab = double.Parse(Console.ReadLine());
- double sum = 0;
- for (int i = 1; i <= day; i++)
- {
- sum += pirate;
- if (i % 3 == 0)
- {
- sum += pirate / 2;
- }
- if (i % 5 == 0)
- {
- sum -= sum * 0.3;
- }
- }
- if (sum >= grab)
- {
- Console.WriteLine($"Ahoy! {sum:f2} plunder gained.");
- }
- else
- {
- Console.WriteLine("Collected only {0:f2}% of the plunder.", (sum/grab)*100);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement