Advertisement
Guest User

Untitled

a guest
Jan 24th, 2018
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System;
  2. namespace _01.Sandbox
  3. {
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             var distance = double.Parse(Console.ReadLine());
  9.             var razhod = double.Parse(Console.ReadLine());
  10.             var benzin = double.Parse(Console.ReadLine());
  11.             var budget = double.Parse(Console.ReadLine());
  12.             var smetka = budget - ((distance * (razhod / 100)) * benzin);
  13.             if (smetka >= 0)
  14.             {
  15.                 Console.Write("You can take a trip. ");
  16.                 Console.Write("{0:f2}", smetka);
  17.                 Console.Write(" money left.");
  18.             }
  19.             else
  20.             {
  21.                 Console.Write("Sorry, you cannot take a trip. Each will receive ");
  22.                 Console.Write("{0:f2}", budget/5);
  23.                 Console.Write(" money.");
  24.             }
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement