NadyaMisheva

bira i chips

Nov 24th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         string name = Console.ReadLine();
  8.         double money = double.Parse(Console.ReadLine());
  9.         int bottles = int.Parse(Console.ReadLine());
  10.         int chips = int.Parse(Console.ReadLine());
  11.         double total = bottles * 1.2 + Math.Ceiling((bottles * 1.20) * 0.45 * chips);
  12.         if(money >= total)
  13.         {
  14.             Console.WriteLine("{0} bought a snack and has {1:F2} leva left.", name, money - total);
  15.         }
  16.         else
  17.         {
  18.             Console.WriteLine("{0} needs {1} more leva!", name, total - money);
  19.         }
  20.     }
  21. }
Add Comment
Please, Sign In to add comment