Advertisement
KeepCoding

December17th2017 Workout C#

Jan 2nd, 2018
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 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 T4WorkoutCode2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             var countOfDay = int.Parse(Console.ReadLine());
  15.             var M = double.Parse(Console.ReadLine());
  16.             var S = M;
  17.             for (int i = 1; i <= countOfDay; i++)
  18.             {
  19.                 var k = double.Parse(Console.ReadLine());
  20.                 M += k / 100.0 * M;
  21.                 S += M;
  22.             }
  23.             var S1 = S - 1000;
  24.             var S2 = Math.Abs(S1);
  25.             if (S1 >= 0)
  26.             {
  27.                 Console.WriteLine($"You've done a great job running {Math.Ceiling(S2)} more kilometers!");
  28.             }
  29.             else
  30.             {
  31.                 Console.WriteLine($"Sorry Mrs. Ivanova, you need to run {Math.Ceiling(S2)} more kilometers");
  32.             }
  33.         //main ends here
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement