Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started