Advertisement
Guest User

Untitled

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