Sort by

recency

|

3409 Discussions

|

  • + 0 comments

    here for rounding you can use Math.round or you can just add 0.5 to total for rounding value like: sout((int)(total + 0.5));

  • + 0 comments

    I put it all in one line. That way I wouldn't need to use extra variables. This is in C#.

    Console.WriteLine(Math.Round((meal_cost*(tip_percent/100f))+(meal_cost*(tax_percent/100f))+meal_cost));
    
  • + 0 comments

    void solve(double meal_cost, int tip_percent, int tax_percent) { double tip, tax; int total_cost; scanf("%lf", &meal_cost); scanf("%d", &tip_percent); tip = (tip_percent*meal_cost)/100; scanf("%d", &tax_percent); tax = (tax_percent*meal_cost)/100; total_cost = round(meal_cost+tip+tax); printf("%d", total_cost); }

  • + 0 comments

    tip = tip_percent * meal_cost / 100 tax = tax_percent * meal_cost / 100 total_bill = meal_cost + tip + tax print(round(total_bill))

  • + 0 comments

    JavaScript CODE

    let tip = tip_percent * meal_cost / 100;
    let tax = tax_percent * meal_cost / 100;
        
    console.log(Math.round(tip + tax + meal_cost));