how do i determine the sum of all integers between 1 and 1000 inclusive which are multiples of 5 or 8 or both?
First count the sum of all integers between 1 and 1000 inclusive which are multiples of 5.Call it a.
Then count the sum of all integers between 1 and 1000 inclusive which are multiples of 8.Call it b.
Now a+b will have the sum of all integers between 1 and 1000 inclusive which are multiples of 5 and 8, with repetitions. Numbers that are divisible by both 8 and 5 would have occurred in both a and b. Thus 'a+b' has counted multiples of 40 twice. So you will have to subtract the sum of all integers between 1 and 1000 inclusive which are multiples of 40 from 'a+b'.
So the process is easy if you can answer the following questions:
1) How to determine the sum of all integers between 1 and 1000 inclusive which are multiples of 5?
2) How to determine the sum of all integers between 1 and 1000 inclusive which are multiples of 8?
3) How to determine the sum of all integers between 1 and 1000 inclusive which are multiples of 40?