Saturday, 20 June 2015

Five to Three - Fifteen

Project Euler #1: Multiples of 3 and 5

Читать на Русском

Problem Statement on  HackerRank ProjectEuler+. This problem is a programming version of problem #1 from ProjectEuler.


Given a positive integer n. Find the sum of all positive integers below n that are multiples of 3 or 5.


Input format

First line contains t (1 ≤ t ≤ 10000) that denotes the number of test cases. Each of the following t lines contains single integer n (1 ≤ n ≤ 10000).

Output format

For every n print the sum of all positive integers below n that are multiples of 3 or 5.

Status: Accepted
Before reading the editorial I recommend you to solve the problem by yourself.