Write a function that returns the sum of multiples of 3 and 5 between 0 and limit (parameter)
Answers
Answered by
0
Answer:
1) Create a function which takes an integer parameter called limit
2) Inside the function:
2.1) Create a variable called sum and set it to zero.
2.2) Run a loop from 0 to limit inclusively.
2.3) Inside the loop:
2.3.1) If the loop variable is a multiple of 3, add it to sum
2.3.2) Otherwise, if it's a multiple of 5, add it to sum
2.4) After the loop, return sum
Similar questions