finds the average number of hours per day spent programming by each student over a three-day weekend. User should enter the number of hours worked each day and number of students.

Add up all the hours, multiply by three, divide by the number of students.

## All 3 Replies

Add up all the hours, multiply by three, divide by the number of students.

Shouldn't that be a divide by three?

The question's not so clear. Does "number of hours worked each day" imply that one number will be entered to be considered the amount worked each day (i.e. same amount every day), or will there be three values entered per student? Either way, I think I am missing a divide by three at the end, or alternatively don't bother multiplying by three (if it's one number representing the amount worked during each of three days). If the OP can't calculate an average, actually coding it up is moot anyway.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.