DEV Community

Ogunniyi Owamamwen
Ogunniyi Owamamwen

Posted on

C# - Day 2: Operators - 30 Days of Code HackerRank

class Result
{

/*
 * Complete the 'solve' function below.
 *
 * The function accepts following parameters:
 *  1. DOUBLE meal_cost
 *  2. INTEGER tip_percent
 *  3. INTEGER tax_percent
 */

public static void solve(double meal_cost, int tip_percent, int tax_percent)
{
    // write the code here
    double tip = meal_cost * tip_percent / 100;
    double tax = meal_cost * tax_percent / 100;
    int total_cost =(int)Math.Round(meal_cost + tip + tax);
    Console.WriteLine(total_cost);
}
Enter fullscreen mode Exit fullscreen mode

}

Top comments (0)