C++ program for sum of all integers between 100 and 9000 and are divisible by 7
Answers
Answer:
Program to find sum of all integers between 100 to 9000 and are divisible by 7 in c
Answer:
5783050.
Step-by-step explanation:
= 5783050.
Hence, the sum of all integers between 100 to 9000 and are divisible by 7 is 5783050.
✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌
Explanation:
IAnswer:
5783050
Step-by-step explanation:
Since, integers between 100 to 9000 that are divisible by 7,
105, 112, 119, .......... 8995,
Which is an AP,
Having first term, a = 105,
d = 7,
Last term, l = 8995
Let n be the total number of terms,
\implies a + (n-1)d = l⟹a+(n−1)d=l
105 + (n - 1)7 = 8995105+(n−1)7=8995
7(n-1) = 88907(n−1)=8890
n - 1 = 1270n−1=1270
\implies n = 1271⟹n=1271
Hence, the sum of the above AP,
S_{1271}=\frac{1271}{2}(2(105)+(1271-1)7)S
1271
=
2
1271
(2(105)+(1271−1)7)
=\frac{1271}{2}(210+1270(7))=
2
1271
(210+1270(7))
=\frac{1271}{2}(9100)=
2
1271
(9100)
=1271\times 4550=1271×4550
= 5783050
Hence, the sum of all integers between 100 to 9000 and are divisible by 7 is 5783050.