In this javascript code there are 4 test cases, 4th test case was not getting expected output
Test cases are in below url link
https://drive.google.com/file/d/1pUV22FRZxZXuZQdyywfDXs2pS30r6dKc/view?usp=sharing
Code in below url link
https://drive.google.com/file/d/15gIWqTU2mGKhr8gaVS-lVXNed5jxPXXQ/view?usp=sharing
/* Please do not modify anything above this line */
function main() {
const dayCharge = JSON.parse(readLine());
const days = parseInt(readLine());
let bill, discount;
bill = dayCharge * days;
if (days > 2 && days <= 5) { // changes >= to >
discount = 5;
bill= bill - (bill * discount) / 100;
}
if (days > 5) { // changed >= to >
discount = 15;
bill= bill - (bill * discount) / 100;
}
console.log(`${bill}`);
}
Comments
Awesome ! Thank u you very much
Leave a comment