Computer Science, asked by josephyteq, 5 months ago

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 1000 in java

Answers

Answered by rudraprasadsinha43
1

Answer:

multiple of 3 and 5

3+5+6+9+10+12+15+………….+1000

we divide this as below to make an AP series and find the number of terms in all series by using AP formula: T=a+(n-1)d ,and find sum by : S=n/2[2*a+(n-1)d]

where : a=first term ,n=no. of term , d=common deference, T=nth term

multiple of 3

3+6+9+12+15+…………..+999

no. of term(n) =333

S=333/2[2*3+(333–1)*3] =166833

multiple of 5

5+10+15+20+…………. +995

n=199

S=199/2[2*5+(199–1)*5] =99500

common in both(these no. are going to repeat, so subtract once)

15+30+45+…………..+990

n=66

S=66/2[2*15+(66–1)*15] =33165

now,

sum of multiple of 3 or 5 = (sum of multiple of 3) + (sum of multiple of 5) - (sum of common terms)

sum of multiple of 3 or 5=166833+99500–33165

233168 (answer)

THE END.

Explanation:

Plzz mark me as brainlist..

Similar questions