某公司搞促销(每单限买1件),共售出10693件商品,原件36元,尾数为888免单,尾数为3炸弹号打5折,尾数为88打75折,尾数为8打9折,请计算并输出总销售额。使用JavaScript if循环
var total = 0;
for (var i = 0 ; i < 10693;i++){
if (i % 1000 == 887){continue}
if (((i + 1) % 1000) / 111 == Math.floor(((i + 1) % 1000) / 111)){total += 36 * .5;continue}
if (i % 100 == 87){total += 36 * .75;continue}
if (i % 10 == 7){total += 36 * .9;continue}
total += 36
}
console.log(total)