Question: If we list all the natural numbers below 1 0 that are multiples of 3 or 5 , we get 3 , 5 , 6
If we list all the natural numbers below that are multiples of or we get and The sum of these multiples is
Find the sum of all the multiples of or below N
Input Format
First line contains T that denotes the number of test cases. This is followed by T lines, each containing an integer, N
Constraints
T
N
Output Format
For each test case, print an integer that denotes the sum of all the multiples of or below N
Sample Input
Sample Output
Explanation
For N if we list all the natural numbers below that are multiples of or we get and The sum of these multiples is
Similarly for N we get
Python Code
import sys
t intinputstrip
for a in ranget:
n intinputstrip
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
