We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
function solve(meal_cost, tip_percent, tax_percent) {
// Write your code here
const tip = (tip_percent/100) * meal_cost;
const tax = (tax_percent/100) * meal_cost;
const total_cost = meal_cost + tip + tax;
console.log(Math.floor(total_cost));
}
why my code doesn't work for the last test case that it works fine for the rest three test cases.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 2: Operators
You are viewing a single comment's thread. Return to all comments →
function solve(meal_cost, tip_percent, tax_percent) { // Write your code here const tip = (tip_percent/100) * meal_cost; const tax = (tax_percent/100) * meal_cost; const total_cost = meal_cost + tip + tax; console.log(Math.floor(total_cost)); }
why my code doesn't work for the last test case that it works fine for the rest three test cases.