VB编程,编写计算fun(N)=1×2+2×3+3×4+...+n×(n+1)的运算,n为任意整数

如题所述

'窗体上加一个命令按钮即可。供参考。祝进步。朋友。
Private Sub Command1_Click()
Dim n As Integer
n = InputBox("请输入一个正整数")
Print "fun(N)=1*2+2*3+3*4+...+n*(n+1)结果为:"; myfun(n)
End Sub
Private Function myfun(ByVal n As Integer) As Long
Dim m As Long
For i = 1 To n
m = m + i * (i + 1)
Next i
myfun = m
End Function
温馨提示:内容为网友见解,仅供参考
无其他回答

...正整数n,请设计一个程序框图,求s=1×2+2×3+3×4+…+n(n+1)的值...
Dim n As Integer n = InputBox("请输入一个正整数")Print "fun(N)=1*2+2*3+3*4+...+n*(n+1)结果为:"; myfun(n)End Sub Private Function myfun(ByVal n As Integer) As Long Dim m As Long For i = 1 To n m = m + i * (i + 1)Next i myfun = m End Functio...

计算“1*2+2*3+3*4+···+n*(n+1)”的VB编程
=[n(n+1)(2n+1)\/6]+[n(n+1)\/2]=[n(n+1)\/6]×{(2n+1)+3]=n(n+1)(n+2)\/3

...n项f(n) = 1×2 + 2×3 + 3×4 + …… + n×(n+1)
include <stdio.h>int sumn(int n,int *flag){ (*flag)++; if(n==1) return n*(n+1); else return n*(n+1)+sumn(n-1,flag);}int main(){ int count=0,result; int n=0; scanf("%d",&n); if(n>0) { result=sumn(n,&count); printf("%d\\n",result); } ...

编程s=1*2+2*3+3*4+4*5+...n*(n+1)
{ int n,i;int sum=0;printf("enter n");scanf("%d",&n);for(i=1;i<=n;i++){ sum += i*(i+1);} printf("%d",sum);}

c语言 求 1*2+2*3+3*4+……+n*(n+1)之和 n为输入键盘
include <stdio.h>int main(){int n,sum=0,i;printf("输入n:");scanf("%d",&n);for(i=1;i<=n;i++)sum+=i*(i+1);printf("%d",sum);return 0;}

1*2+2*3+3*4+...+n*(n+1)怎么算啊?
1*2+2*3+3*4+...+n*(n+1)=(1*1+1)+(2*2+2)+(3*3+3)+...(n*n+n)=(1^2+2^2+3^2+...n^2)+(1+2+3+...n)=n*(n+1)*(2*n+1)\/6+n(n+1)\/2 =n(n+1)(n+2)\/3

1×2+2×3+3×4+4×5……+n×(n+1)怎么求和啊?
一。n(n+1)=n^2+n 原式=(1^2+1)+(2^2+2)+(3^2+3)...+(n^2+n)=(1^2+2^2+3^2+4^2+5^2...+n^2)+(1+2+3+...+n)分组求和,根据公式1^2+2^2+3^2+4^2+5^2...+n^2=n(n+1)(2n+1)\/6以及 1+2+3+...+n=n*(n+1)\/2 所以原式=n(n+1)(2n+...

1*2+2*3+3*4+..+n*(n+1)等于多少
=1^2+1+2^2+2+3^2+3+...+n^2+n =(1^2+2^2+...+n^2)+(1+2+3+...+n)=n(n+1)(2n+1)\/6+n(n+1)\/2 =n(n+1)[(2n+1)\/6+1\/2]=n(n+1)(n+2)\/3

1×2+2×3+3×4+...+n(n+1)
1×2+2×3+3×4+...+n(n+1)=(1×1+1)+(2×2+2)+(3×3+3)+...(n×n+n)=(1^2+2^2+3^2+...n^2)+(1+2+3+...n)=n*(n+1)*(2*n+1)\/6+n(n+1)\/2 =n(n+1)(n+2)\/3

...法求1*2*3 + 2*3*4 +3*4*5 +... +n*(n+1)*(n+2)的值,怎么编?_百度...
unsigned int f(unsigned int n){ return n!=1 ? n*(n+1)*(n+2)+f(n-1) : 6;} int main(int argc,char *argv[]){ unsigned int n;printf("Enter n(int 0<n<1601)...\\nn=");\/\/n>1600后可能会溢出 if(scanf("%d",&n)==1 && n>0 && n<1601)printf("The result ...

相似回答