Thursday 20 September 2012

1+(1+2)*2+(1+2+3)*3+(1+2+3+4)*4 if n=1 then o/p is 1 if n=2 then o/p is 1+(1+2)*2 if n=3 then o/p is 1+(1+2)*2+(1+2+3)*3

n=cint(inputbox("Enter the value"))

For i=1 to n
For j=1 to i

    c=c+j

    If j=i Then
        e=e+(c*j)
    End If

    Next
    c=empty
Next
print e

No comments:

Post a Comment