Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp3
- {
- class Program
- {
- static void Main(string[] args)
- {
- int days = int.Parse(Console.ReadLine());
- short daily = short.Parse(Console.ReadLine());
- float expectation = float.Parse(Console.ReadLine());
- float plunder = 0;
- for (int i = 1; i <= days; i++)
- {
- plunder += daily;
- if (i % 3 == 0)
- {
- plunder += (daily / 2);
- }
- if (i % 5 == 0)
- {
- plunder -= (plunder / 10) * 3;
- }
- }
- if (plunder >= expectation)
- {
- Console.WriteLine($"Ahoy! {string.Format("{0:0.00}", plunder)} plunder gained.");
- }
- else
- {
- Console.WriteLine($"Collected only {string.Format("{0:0.00}", (plunder /expectation)*100)}% of the plunder.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement