Menu
Coddy logo textTech

Splitting The Bill

Part of the Fundamentals section of Coddy's JavaScript journey — lesson 36 of 77.

challenge icon

Challenge

Beginner

Now we have a working program that calculates the total bill! The missing part is the splitting feature.

Add to the program a splitting feature:

  1. It will take an additional number (int) from the user that indicates the number of people splitting the bill. (This will be the third input)
  2. Calculate the amount per person by dividing the total amount by the number of people.
  3. In the end, add another print of the amount per person.

Try it yourself

let billAmount = parseFloat(inp[0]); // Don't change this line
let tipPercentage = parseFloat(inp[1]); // Don't change this line
let numPeople = parseInt(inp[2]); // Don't change this line

// Type your code below

All lessons in Fundamentals