Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- document.write("Вычисление стоимости покупки с учетом скидки");
- let purchase = +prompt("Стоимость покупки");
- document.write("<br> Сумма без скидки: " + purchase);
- let discount = 0;
- let discountFrom500 = 0.03;
- let discountFrom1000 = 0.05;
- let summary = purchase;
- if(purchase > 1000){
- discount = discountFrom1000;
- }
- else if(purchase > 500){
- discount = discountFrom500;
- }
- else{
- discount = 0;
- }
- summary*=(1-discount);
- document.write("<br> Вам предоставляется скидка : " + discount * 100 + "%");
- document.write("<br> Итоговая сумма: " + summary);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement