编程求s=1*2+2*3+3*4+……+n*(n+1),当s>200000时n的最小值
来源:百度知道 编辑:UC知道 时间:2024/06/25 08:15:22
等一下!
#include<stdio.h>
main()
{
int n=0,t=0,s=0;
for(n=1;;n++)
{ t=n*(n+1);
s=s+t;
if(s>200000) break;
}
printf("%d",n);
}
解:s=0,n=1
if s>200 000
print n
else n=n+1
m=n*(n+1)
s=s+m
endif
end
#include <stdio.h>
int main()
{
int n = 0;
int s = 0;
while(s<200000)
{
n++;
s+=n * (n+1);
}
printf("%d\n",n);
}
double s=0;
while(s<200000)
{
s+=n*(n+1);
n++;
}
printf("%d",n-1);
#include <stdio.h>
int main()
{
int n = 1;
int s = 0;
do
{
s = s + n * (n+1);
n++;
}
while (s < 200000);
printf("%d\n",n);
}
结果是:85
编程求 s=1+2+3+4+1*1+2*2
VB:求S=1!+2!+3!+……+20!的编程代码
编程计算:S=1!+2!+3!+4!+5!
用C语言编程:求S=1+(1+2)+…+(1+2+3+4+5+6)=?
急求大哥大姐们帮帮忙:用c语言编程计算S=1-2!+3!-4!+....-10!
编程trog1,trg.求s=1!+21+3!+``````20!吧
C编程----求1!+2!+3!+...7!.应该如何编程?
一个c语言编程问题:求s=1/2-2/3+3/5-5/8+.....相加的项数n从键盘输入
编程计算s=1!+2!+3!+4!+5!的值
编程计算 S=1+2+3+4...+99+100的值