Teo_Yanchev

TheBlackFlag

Nov 7th, 2020
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _01._BlackFLag
  4. {
  5. class BlackFlag
  6. {
  7. static void Main(string[] args)
  8. {
  9. int daysPirating = int.Parse(Console.ReadLine());
  10. int plunderForDay = int.Parse(Console.ReadLine());
  11. double expectedPlunder = double.Parse(Console.ReadLine());
  12.  
  13.  
  14. double plunder = 0;
  15. for (int i = 1; i <= daysPirating; i++)
  16. {
  17. if (i % 3 == 0)
  18. {
  19. double plunderTheThirdDay = plunderForDay * 1.50;
  20.  
  21. plunder += plunderTheThirdDay;
  22. }
  23.  
  24. else
  25. {
  26. plunder += plunderForDay;
  27.  
  28. }
  29.  
  30. if (i % 5 == 0)
  31. {
  32. plunder *= 0.70;
  33. }
  34.  
  35. }
  36.  
  37. if (plunder >= expectedPlunder)
  38. {
  39. Console.WriteLine($"Ahoy! {plunder:f2} plunder gained.");
  40. }
  41. else
  42. {
  43. double percentage = plunder / expectedPlunder * 100;
  44. Console.WriteLine($"Collected only {percentage:f2}% of the plunder.");
  45. }
  46. }
  47. }
  48. }
  49.  
Advertisement
Add Comment
Please, Sign In to add comment