Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _01._BlackFLag
- {
- class BlackFlag
- {
- static void Main(string[] args)
- {
- int daysPirating = int.Parse(Console.ReadLine());
- int plunderForDay = int.Parse(Console.ReadLine());
- double expectedPlunder = double.Parse(Console.ReadLine());
- double plunder = 0;
- for (int i = 1; i <= daysPirating; i++)
- {
- if (i % 3 == 0)
- {
- double plunderTheThirdDay = plunderForDay * 1.50;
- plunder += plunderTheThirdDay;
- }
- else
- {
- plunder += plunderForDay;
- }
- if (i % 5 == 0)
- {
- plunder *= 0.70;
- }
- }
- if (plunder >= expectedPlunder)
- {
- Console.WriteLine($"Ahoy! {plunder:f2} plunder gained.");
- }
- else
- {
- double percentage = plunder / expectedPlunder * 100;
- Console.WriteLine($"Collected only {percentage:f2}% of the plunder.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment