#include <iostream>
using namespace std;
double calculateTotal(double price) {
double discount = 0.0;
if (price > 1000) {
discount = 0.05; // Знижка 5%
} else if (price > 500) {
discount = 0.03; // Знижка 3%
}
double finalPrice = price - (price * discount);
return finalPrice;
}
int main() {
double price;
cout << "Введіть вартість покупки: ";
cin >> price;
double total = calculateTotal(price);
cout << "Сума з урахуванням знижки: " << total << " грн" << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKZG91YmxlIGNhbGN1bGF0ZVRvdGFsKGRvdWJsZSBwcmljZSkgewogICAgZG91YmxlIGRpc2NvdW50ID0gMC4wOwoKICAgIGlmIChwcmljZSA+IDEwMDApIHsKICAgICAgICBkaXNjb3VudCA9IDAuMDU7ICAvLyDQl9C90LjQttC60LAgNSUKICAgIH0gZWxzZSBpZiAocHJpY2UgPiA1MDApIHsKICAgICAgICBkaXNjb3VudCA9IDAuMDM7ICAvLyDQl9C90LjQttC60LAgMyUKICAgIH0KCiAgICBkb3VibGUgZmluYWxQcmljZSA9IHByaWNlIC0gKHByaWNlICogZGlzY291bnQpOwogICAgcmV0dXJuIGZpbmFsUHJpY2U7Cn0KCmludCBtYWluKCkgewogICAgZG91YmxlIHByaWNlOwogICAgCiAgICBjb3V0IDw8ICLQktCy0LXQtNGW0YLRjCDQstCw0YDRgtGW0YHRgtGMINC/0L7QutGD0L/QutC4OiAiOwogICAgY2luID4+IHByaWNlOwoKICAgIGRvdWJsZSB0b3RhbCA9IGNhbGN1bGF0ZVRvdGFsKHByaWNlKTsKICAgIAogICAgY291dCA8PCAi0KHRg9C80LAg0Lcg0YPRgNCw0YXRg9Cy0LDQvdC90Y/QvCDQt9C90LjQttC60Lg6ICIgPDwgdG90YWwgPDwgIiDQs9GA0L0iIDw8IGVuZGw7CgogICAgcmV0dXJuIDA7Cn0K