You are viewing a single comment's thread. Return to all comments →
def sum_of_multiples(n): total_sum = 0 for i in range(n): if i % 3 == 0 or i % 5 == 0: total_sum += i return total_sum if __name__ == '__main__': t = int(input().strip()) results = [] for _ in range(t): n = int(input().strip()) results.append(sum_of_multiples(n)) for result in results: print(result)
this shows time excedence how do i manage that can anyone tell me
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #1: Multiples of 3 and 5
You are viewing a single comment's thread. Return to all comments →
this shows time excedence how do i manage that can anyone tell me