We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
t = int(input().strip())
s=[]
for a0 in range(t):
n = int(input().strip())
s.append(n)
u=s[0]
v=s[1]
s1=[]
s2=[]
for j in range(1,u):
if(j%3==0 or j%5==0):
s1.append(j)
for j in range(1,v):
if(j%3==0 or j%5==0):
s2.append(j)
print(sum(s1))
print(sum(s2))
Cookie support is required to access HackerRank
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 →
t = int(input().strip()) s=[] for a0 in range(t): n = int(input().strip()) s.append(n) u=s[0] v=s[1] s1=[] s2=[] for j in range(1,u): if(j%3==0 or j%5==0): s1.append(j)
for j in range(1,v): if(j%3==0 or j%5==0): s2.append(j)
print(sum(s1)) print(sum(s2))