Tag Archives: operators

Hackerrank “30 Days of Code” Çözümleri – Day 2: Operators

Hackerrank‘in 30 Days of Code içerisinde bulunan “Day 2: Operators” sorusunun açıklaması ve çözümü. Bu soruda size verilen yemek ücreti, bahşiş ve vergi yüzdeleri ile birlikte toplamda ne kadar para ödemeniz gerektiğinizi bulmanız isteniyor.

► Hackerrank 30 Days of Code Çözümleri – Day 2: Operators: https://www.hackerrank.com/challenges/30-operators/problem

► Problem açıklaması:


In this challenge, you will work with arithmetic operators. Check out the Tutorial tab for learning materials and an instructional video.


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.


mealCost = 100

tipPercent = 15

taxPercent = 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.

Note: Be sure to use precise values for your calculations, or you may end up with an incorrectly rounded result.

Input Format

There are 3 lines of numeric input:

The first line has a double, mealCost (the cost of the meal before tax and tip).

The second line has an integer, tipPercent (the percentage of mealCost being added as tip).

The third line has an integer, taxPercent (the percentage of mealCost being added as tax).

Sample Input




Sample Output