Penghitung discount + PPN

Run Settings
LanguageJavaScript
Language Version
Run Command
function discount(input) { const ppn = 15; const harga = 500000; const idr = new Intl.NumberFormat("id-ID"); const disc = Number(input); const ppNegara = Number(ppn / 100) * harga; const potongan = Number(disc / 100) * harga; const total = Number(harga - potongan); const diBayar = Number(total + ppNegara); return console.log(` =======( RIKI WAHYUDI )======= \n Harga: Rp.${idr.format(harga)} Potongan: ${disc}% PPN: +${ppn}% Harga Discount: Rp.${idr.format(total)} \n ============================== Total: Rp.${idr.format(diBayar)} `) } process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; }); process.stdin.on("end", function () { discount(_input); });
Editor Settings
Theme
Key bindings
Full width
Lines