Advertisement
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 km = int.Parse(Console.ReadLine());
- double consuption = double.Parse(Console.ReadLine());
- double gasolinePrice = Double.Parse(Console.ReadLine());
- int money = int.Parse(Console.ReadLine());
- double litersFuel = km * consuption / 100;
- double cost = litersFuel * gasolinePrice;
- double available = money - cost;
- if (available >= 0)
- {
- Console.WriteLine($"You can go home. {available:f2} money left.");
- }
- else
- {
- Console.WriteLine($"Sorry, you cannot go home. Each will receive {money*1.0/5:f2} money.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement