5 5 only!

Level 2

What is the sum of all three-digit numbers that are divisible by 5 5 ?


The answer is 98550.

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.

5 solutions

Razing Thunder
Jul 5, 2020
1
2
3
4
5
a=0
for i in range(100,1000):
    if i%5==0:
        a=a+i
print(a)        

Võ Trọng
Jan 25, 2014

Using Turbo Pascal, we have this following code:

uses crt;

var a,b,c,u,i:longint;

begin

clrscr;

i:=0;

u:=0;

for a:=1 to 9 do

for b:=0 to 9 do

for c:=0 to 9 do

begin

i:=100*a+10b+c;

if (i mod 5)=0 then u:=u+i;

end;

write(u);

readln;

end.

Gives u = 98550 u=98550

Patrick Feltes
Mar 27, 2014

Java code:

int sum = 0; for(int i = 100; i < 1000; i += 5) { sum += i; } System.out.println(sum);

Dinesh Inspire
Mar 15, 2014

Python Code

        for n in range(99, 1000):
                 if (n % 10 == 0 or n % 5==0):
                        sum=sum+n

        print  sum

why you check for that the no. is divisible by 10

Razing Thunder - 11 months, 1 week ago
Prasun Biswas
Feb 1, 2014

The 3-digit numbers which are divisible by 5 are 100 , 105 , 110 , . . . . . . , 995 100,105,110,......,995 . These numbers are in AP with first term ( a ) = 100 (a)=100 and common difference ( d ) = 5 (d)=5 . Let a n a_{n} be last term. So,

a n = 995 a + ( n 1 ) d = 995 100 + ( n 1 ) 5 = 995 n 1 = 1095 5 = 179 n = 180 a_{n}=995 \implies a+(n-1)d=995 \implies 100+(n-1)5=995 \implies n-1=\frac{1095}{5}=179 \implies n=180

Thus, there are 180 terms in the AP, so we use here the formula of sum of AP, S = n 2 ( a + l ) S=\frac{n}{2}(a+l) where l = l= Last term

So, S = 180 2 ( 100 + 995 ) = 90 × 1095 = 98550 S=\frac{180}{2}(100+995)=90\times 1095 = \boxed{98550}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...