Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Threading;
- namespace ConsoleApp1
- {
- class Exam
- {
- static void Main(string[] args)
- {
- double steps = double.Parse(Console.ReadLine());
- double lenghtSteps = double.Parse(Console.ReadLine());
- double distance = double.Parse(Console.ReadLine());
- double sumSteps = 0;
- for (int i = 1; i <= steps; i++)
- {
- if (i % 5 == 0)
- {
- sumSteps += lenghtSteps * 0.70;
- }
- else
- {
- sumSteps += lenghtSteps;
- }
- }
- sumSteps /= 100;
- double percentage = sumSteps / distance * 100.0;
- Console.WriteLine($"You travelled {percentage:f2}% of the distance!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement