Ask Question
25 June, 01:55

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Write function that take a number n and return the sum of all the multiples of 3 or 5 below n.

+3
Answers (1)
  1. 25 June, 03:11
    0
    The function is provided below.

    Step-by-step explanation:

    Running the program in Python, the code for this problem is as follows:

    def func (n):

    count = 0 * *initializing the sum with 0**

    for i in range (1, n):

    if i%3 = = 0 or i%5 = = 0:

    count = count + 1

    return (count)

    When the program is executed enter value 1 to 10 one by one and the result will be 23, the sum of all the multiples of 3 and 5.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Write ...” in 📘 Mathematics if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers