What is the sum of all integers which are multiples of 7 and are between 100 and 1000?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
1st term a = 1 0 5 = 7 × 1 5
Last term = 9 9 4 = 7 × 1 4 2
Number of terms n = 1 4 2 − 1 5 + 1 = 1 2 8
Difference d = 7
S n = n / 2 ( ( 2 a + ( n − 1 ) d )
S n = 7 0 3 3 6
Alternatively,
S n = n / 2 [ a + last term ] = 6 4 ( 1 0 5 + 9 9 4 ) = 7 0 3 3 6
I have made it with c programming
int a[10000]; int main() { int sum=0,i; for(i=100;i<1000;i++) { if((i%7)==0) { a[i]=i; } } for(i=100;i<1000;i++) { printf("%d\t",a[i]); sum=sum+a[i]; } printf("%d",sum); }
First term of multiple of 7 between 100 and 1000 = a = 105
Last term = L = 994
Total no. of terms = n = (994 - 105)/7 + 1 = 128
Difference between terms = d = 7
Sum of terms = S = n/2(2 a + (n-1) d) = 128/2(2 105 + (127) 7) = 64(210 + (889) = 70336
Therefore, sum of all terms of multiple of 7 between 100 and 1000 is 70,336.
it is an AR FIRST OF ALL. 142x7=994, &15x7=105, so use the formula of n(n+1)/2 from 1 to 142 then subtract the summation of first 14 natural no. and the multiply this with 7 as it is a multiple of 7 . and the answer is 70336,
c = 0
for x in range(100, 1000) :
if (x%7) == 0 :
c = c + x
print c
I personally was feeling incredibly time wasteful today, so I wrote a reusable version in my childhood programming language, Microsoft Small Basic. Took a hundred lines, but hey, it can write the whole list of multiples of any number over any range to a CSV file if so desired, as well as calculating the product and sum of the multiples. Twenty minutes of my life down the drain...
Subroutines for the sum, where LowerLimit = 100, UpperLimit = 1000, and Factor = 7:
Sub Create_Array
Count = 1
For i = LowerLimit To UpperLimit
If Math.Remainder(i, Factor) = 0 Then
ListOfMultiples[Count] = i
Count = Count + 1
EndIf
EndFor
EndSub
Sub Sum
Total = 0
For i = 1 To Array.GetItemCount(ListOfMultiples)
Total = Total + ListOfMultiples[i]
EndFor
TextWindow.WriteLine("The sum is " + Total + ".")
EndSub
Ugly code, unnecessary code, but by gar, it did the job, it's reusable, and it was fun.
Problem Loading...
Note Loading...
Set Loading...
It is simple A.P problem. By mere inspection we get First term (a) of the series is 105 and last term (l) is 994 . By using the formula t th term = a + (n-1).d where n = no. of terms in series and d= difference which in this case is 7 ( since multiples of 7 is given ) . From this we get n = 128. Then using the sum formula of an A.P. series S(n) = (n/2 )*(a+l) we get the sum to be 70336.