How will you do it? (II)

a = 1 10 b = a 10 c = b 10 ( a + b + c ) = ? \sum_{a=1}^{10} \sum_{b=a}^{10} \sum_{c=b}^{10} {(a+b+c)}= \, ?


this problem is a part of the set Fundamental Programming
2420 3036 2024 3630

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.

3 solutions

Zeeshan Ali
Jan 3, 2016

Here is an algorithm which does your required work;

1
2
3
4
5
6
    sum<-0
    for a<-1 to 10
        for b<-a to 10
            for c<-b to 10
                sum<-sum+a+b+c
    return sum

Isn't that so simple.!?

Vignesh Suresh
Jan 5, 2016

int count=0;

for(int a=1;a<=10;a++)
for(int b=a;b<=10;b++)
for(int c=b;c<=10;c++)
count+=a+b+c;
Masbahul Islam
Jan 4, 2016

Excel vba code:

s = 0

For a = 1 To 10

For b = a To 10

For c = b To 10

s = s + a + b + c

Next c, b, a

MsgBox s

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...