Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ExamPreparation._02.Summer_Shopping
- {
- class Program
- {
- static void Main(string[] args)
- {
- int budget = int.Parse(Console.ReadLine());
- double summerTowel = double.Parse(Console.ReadLine());
- int percent = int.Parse(Console.ReadLine());
- double umbrella = summerTowel * 2 / 3;
- double flipFlops = 0.75 * umbrella;
- double bag = (flipFlops + summerTowel) * 1 / 3;
- double finalSum = (umbrella + summerTowel + flipFlops + bag) - ((umbrella + summerTowel + flipFlops + bag) * ((double)percent / 100));
- if (finalSum <= budget)
- Console.WriteLine($"Annie's sum is {finalSum:f2} lv. She has {budget - finalSum:f2} lv. left.");
- else if (finalSum > budget)
- Console.WriteLine($"Annie's sum is {finalSum:f2} lv. She needs {finalSum - budget:f2} lv. more.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement