30 Days of Code HackerRank using JAVASCRIPT DAY 2 : Operators

Task
Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax) for a meal, find and print the meal’s total cost. Round the result…


This content originally appeared on DEV Community and was authored by Teja

Task
Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax) for a meal, find and print the meal's total cost. Round the result to the nearest integer.

Example

meal cost = 100
tip percentage = 15
tax percentage = 8
A tip of 15% * 100 = 15, and the taxes are 8% * 100 = 8. Print the value 123 and return from the function.

Function Description
Complete the solve function in the editor below.

solve has the following parameters:

int meal_cost: the cost of food before tip and tax
int tip_percent: the tip percentage
int tax_percent: the tax percentage
Returns The function returns nothing. Print the calculated value, rounded to the nearest integer.

SOLUTION

Image description


This content originally appeared on DEV Community and was authored by Teja


Print Share Comment Cite Upload Translate Updates
APA

Teja | Sciencx (2024-07-13T05:07:54+00:00) 30 Days of Code HackerRank using JAVASCRIPT DAY 2 : Operators. Retrieved from https://www.scien.cx/2024/07/13/30-days-of-code-hackerrank-using-javascript-day-2-operators/

MLA
" » 30 Days of Code HackerRank using JAVASCRIPT DAY 2 : Operators." Teja | Sciencx - Saturday July 13, 2024, https://www.scien.cx/2024/07/13/30-days-of-code-hackerrank-using-javascript-day-2-operators/
HARVARD
Teja | Sciencx Saturday July 13, 2024 » 30 Days of Code HackerRank using JAVASCRIPT DAY 2 : Operators., viewed ,<https://www.scien.cx/2024/07/13/30-days-of-code-hackerrank-using-javascript-day-2-operators/>
VANCOUVER
Teja | Sciencx - » 30 Days of Code HackerRank using JAVASCRIPT DAY 2 : Operators. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/13/30-days-of-code-hackerrank-using-javascript-day-2-operators/
CHICAGO
" » 30 Days of Code HackerRank using JAVASCRIPT DAY 2 : Operators." Teja | Sciencx - Accessed . https://www.scien.cx/2024/07/13/30-days-of-code-hackerrank-using-javascript-day-2-operators/
IEEE
" » 30 Days of Code HackerRank using JAVASCRIPT DAY 2 : Operators." Teja | Sciencx [Online]. Available: https://www.scien.cx/2024/07/13/30-days-of-code-hackerrank-using-javascript-day-2-operators/. [Accessed: ]
rf:citation
» 30 Days of Code HackerRank using JAVASCRIPT DAY 2 : Operators | Teja | Sciencx | https://www.scien.cx/2024/07/13/30-days-of-code-hackerrank-using-javascript-day-2-operators/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.