petaryankov00

demo

Nov 22nd, 2020
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int days = int.Parse(Console.ReadLine());
  10.             double startKm = double.Parse(Console.ReadLine());
  11.             double sumKm = startKm;
  12.  
  13.             for (int i = 1; i <= days; i++)
  14.             {
  15.                 double percents = double.Parse(Console.ReadLine());
  16.                 double runnedKm = startKm * (percents / 100);
  17.                 startKm += runnedKm;
  18.                 sumKm += startKm;
  19.  
  20.             }
  21.  
  22.             if (sumKm >= 1000)    
  23.             {
  24.                 Console.WriteLine($"You've done a great job running {Math.Round(sumKm-1000)+1} more kilometers!");
  25.             }
  26.             else
  27.             {
  28.                 Console.WriteLine($"Sorry Mrs. Ivanova, you need to run {Math.Round(1000-sumKm)+1} more kilometers!");
  29.             }
  30.         }
  31.     }
  32. }
  33.  
Add Comment
Please, Sign In to add comment