Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int days = int.Parse(Console.ReadLine());
- double startKm = double.Parse(Console.ReadLine());
- double sumKm = startKm;
- for (int i = 1; i <= days; i++)
- {
- double percents = double.Parse(Console.ReadLine());
- double runnedKm = startKm * (percents / 100);
- startKm += runnedKm;
- sumKm += startKm;
- }
- if (sumKm >= 1000)
- {
- Console.WriteLine($"You've done a great job running {Math.Round(sumKm-1000)+1} more kilometers!");
- }
- else
- {
- Console.WriteLine($"Sorry Mrs. Ivanova, you need to run {Math.Round(1000-sumKm)+1} more kilometers!");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment