Find sum of all multiple of 3 and 7 between 1 to 100 using 1 loop in c++
Answers
Answered by
0
The previously posted answer isn't correct. The statement of the problem is to sum the multiples of 3 and 7 below 1000, not up to and equal 1000. The correct answer is∑k1=13333k1+∑k2=11995k2−∑k3=16615k3=166833+99500−33165=233168,∑k1=13333k1+∑k2=11995k2−∑k3=16615k3=166833+99500−33165=233168,where we have the used the identity∑k=1nk=12n(n+1).
Similar questions