Advertisement
desislava_topuzakova

06.

Aug 30th, 2022
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. using System;
  2.  
  3. namespace softuni_basicExam
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int locations = int.Parse(Console.ReadLine());
  10.  
  11. double averageGoldSum = 0;
  12.  
  13. for (int i = 1; i <= locations; i++)
  14. {
  15. double averageGoldPerDayd = double.Parse(Console.ReadLine());
  16. int mineDays = int.Parse(Console.ReadLine());
  17.  
  18. for (int k = 1; k <=mineDays; k++)
  19. {
  20. double gold = double.Parse(Console.ReadLine());
  21. averageGoldSum += gold;
  22. }
  23.  
  24. averageGoldSum /= mineDays;
  25.  
  26. if (averageGoldSum >= averageGoldPerDayd)
  27. {
  28. Console.WriteLine($"Good job! Average gold per day: {averageGoldSum:f2}.");
  29. }
  30. else
  31. {
  32. Console.WriteLine($"You need {averageGoldPerDayd - averageGoldSum:f2} gold.");
  33. }
  34. averageGoldSum = 0;
  35. }
  36. }
  37. }
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement