Programming Basics
02. Friendly Trip_Условие.docx
https://judge.softuni.bg/Contests/Practice/DownloadResource/2728
Ако може някой да ми помогне за грешката!
using System;
namespace FriendlyTrip
{
class FriendlyTrip
{
static void Main()
{
double distanceKilometers = double.Parse(Console.ReadLine());
double costCarKilometers = double.Parse(Console.ReadLine());
double priceFuel = double.Parse(Console.ReadLine());
double sumFriends = double.Parse(Console.ReadLine());
double costCar = (distanceKilometers * costCarKilometers / 100);
double totalCost = (costCar * priceFuel);
double rest = (totalCost - sumFriends);
double result = (sumFriends / 5);
if (sumFriends >= totalCost)
{
Console.WriteLine($"You can take a trip. {0:f2,rest} money left.");
}
else
{
Console.WriteLine( $"Sorry, you cannot take a trip. Each will receive {0:f2,result} money.");
}
}
}
}
Благодаря много!