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.
C#
* public static void bonAppetit(List bill, int NoEat, int charged)
* {
* //remove item that she doesn't it from bill list
* bill.RemoveAt(NoEat);
* //sum the bill and minus the amount charged
* int refund = (charged - (bill.Sum()/2));
* //do simple if else then in console.write IF balance is 0, write Bon Appetit else write refund
* Console.Write(refund == 0 ? "Bon Appetit": refund);
* }
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Bill Division
You are viewing a single comment's thread. Return to all comments →
C# * public static void bonAppetit(List bill, int NoEat, int charged) * { * //remove item that she doesn't it from bill list * bill.RemoveAt(NoEat); * //sum the bill and minus the amount charged * int refund = (charged - (bill.Sum()/2)); * //do simple if else then in console.write IF balance is 0, write Bon Appetit else write refund * Console.Write(refund == 0 ? "Bon Appetit": refund); * }