Project Euler #1: Multiples of 3 and 5

Hi Friends ,

From today onwards I will be solving problems based on the Project Euler.

You can access the site from here. Today is the First Problem of Euler.

Find the sum of all the multiples of 3 or 5 .

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 .

So here is the code of the first problem :

 

Feel free to comment.

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s