You are viewing a single comment's thread. Return to all comments →
C solution, might not be the fasterst/simplest code, but it is what it is
void bonAppetit(int bill_count, int* bill, int k, int b) { int AnnaBill = 0; int actualCost; int refund; for(int i=0; i<bill_count; i++){ AnnaBill += bill[i]; } AnnaBill = AnnaBill - bill[k]; if(AnnaBill/2 == b){ printf("Bon Appetit\n"); } else{ actualCost = AnnaBill / 2; refund = b - actualCost; printf("%d", refund); } }
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 solution, might not be the fasterst/simplest code, but it is what it is