An open API service indexing awesome lists of open source software.

https://github.com/flacode/day2

Project Euler #1: Multiples of 3 and 5
https://github.com/flacode/day2

Last synced: about 1 year ago
JSON representation

Project Euler #1: Multiples of 3 and 5

Awesome Lists containing this project

README

          

# day2
Project Euler #1: Multiples of 3 and 5
Problem Statement

This problem is a programming version of Problem 1 from projecteuler.net

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 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.

Output Format
For each test case, print an integer that denotes the sum of all the multiples of 3 or 5 below N.

Constraints
1≤T≤105
1≤N≤109