Advertisement
cubeBullet

Untitled

Oct 21st, 2022
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp3
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int days = int.Parse(Console.ReadLine());
  10.  
  11. short daily = short.Parse(Console.ReadLine());
  12.  
  13. float expectation = float.Parse(Console.ReadLine());
  14.  
  15. float plunder = 0;
  16.  
  17. for (int i = 1; i <= days; i++)
  18. {
  19. plunder += daily;
  20.  
  21. if (i % 3 == 0)
  22. {
  23. plunder += (daily / 2);
  24. }
  25. if (i % 5 == 0)
  26. {
  27. plunder -= (plunder / 10) * 3;
  28. }
  29. }
  30.  
  31. if (plunder >= expectation)
  32. {
  33. Console.WriteLine($"Ahoy! {string.Format("{0:0.00}", plunder)} plunder gained.");
  34. }
  35. else
  36. {
  37. Console.WriteLine($"Collected only {string.Format("{0:0.00}", (plunder /expectation)*100)}% of the plunder.");
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement