Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 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 _53_Workout
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int N = int.Parse(Console.ReadLine());
  14. int M = int.Parse(Console.ReadLine());
  15.  
  16.  
  17. double totalKm = M;
  18. double kmSum = 0;
  19.  
  20. for (int i = 1; i <= N; i++)
  21. {
  22. double kmInPercent = double.Parse(Console.ReadLine());
  23.  
  24. totalKm = totalKm + totalKm * (kmInPercent / 100);
  25. kmSum += totalKm;
  26. }
  27. if (totalKm < 1000)
  28. {
  29. Console.WriteLine($"Sorry Mrs. Ivanova, you need to run {Math.Ceiling(1000 - kmSum)} more kilometers");
  30. }
  31. else
  32. {
  33. Console.WriteLine($"You've done a great job running {Math.Ceiling(kmSum - 1000)} more kilometers!");
  34. }
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement