limit
sum
n
def calculate_sum(a, N): # Number of multiples m = N / a # sum of first m natural numbers sum = m * (m + 1) / 2 # sum of multiples ans = a * sum print("Sum of multiples of ", a, " up to ", N, " = ", ans) # Driver Code calculate_sum(7, 49)
if number%3 == 0: sum.append(number)if number%5 == 0: sum.append(number)
if number%3 == 0 or number%5 == 0: sum.append(number)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)