Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp27
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write($"Сумма покупки: ");
- string userInput = Console.ReadLine();
- int value;
- if (int.TryParse(userInput,out value))
- {
- if (value >= 10000 && value <= 30000)
- Console.WriteLine($"Скидка 5%. Сумма: {GetPriceDiscount(value,5)}");
- else if (value > 30000)
- Console.WriteLine($"Скидка 10%. Сумма: {GetPriceDiscount(value,10)}");
- else
- Console.WriteLine($"Скидка 0%. Сумма: {value}");
- }
- else
- {
- Console.WriteLine("Ошибка ввода!");
- }
- }
- private static float GetPriceDiscount(float value, float discountValue)
- {
- discountValue /= 100;
- float dicountPrice = value - (value * discountValue);
- return dicountPrice;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment