Advertisement
dradoslavov89

Untitled

Jul 17th, 2018
672
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Salary
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var days = int.Parse(Console.ReadLine());
  14. var km = int.Parse(Console.ReadLine());
  15. double day1 =+km;
  16. double total = +km;
  17. for (int i = 1; i <=days; i++)
  18. {
  19. var percent = double.Parse(Console.ReadLine());
  20. percent = percent / 100;
  21. day1 += day1 * percent;
  22. total += day1;
  23.  
  24. if (total<1000&&days==i)
  25. {
  26. total = 1000-total;
  27. Console.WriteLine($"Sorry Mrs. Ivanova, you need to run {Math.Ceiling(total)} more kilometers");
  28. }
  29. else if (total>1000&&days==i)
  30. {
  31.  
  32. total = total - 1000;
  33. Console.WriteLine($"You've done a great job running {Math.Ceiling(total)} more kilometers!");
  34. }
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement