Question: The problem is to create a function roundSum which takes three integers as input and returns their sum. However, before adding, each number should be

The problem is to create a function roundSum which takes three integers as input and returns their sum. However, before adding, each number should be rounded to the nearest multiple of 10. If the last digit of the number is 5 or more, round up to the next multiple of 10. If its less than 5, round down to the previous multiple of 10.
The roundSum function should accept three parameters:
a: an integer value.
b: an integer value.
c: an integer value.
Additionally, to avoid repetition, write a helper function round10 which will perform the rounding operation.
Here are some examples:
roundSum(16,17,18) should return 60

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!