编程序求1~99的平方根的和并输出结果。(保留小数点两位)
答案:5 悬赏:70 手机版
解决时间 2021-03-18 10:04
- 提问者网友:轮囘Li巡影
- 2021-03-17 09:37
用VB
最佳答案
- 五星知识达人网友:旧脸谱
- 2021-03-17 09:46
excel中任意单元格输入:
=SUM(SQRT(ROW(1:99)))
ctrl+shift+enter结束
结果为:661.4629471
用时不超过3s。
=SUM(SQRT(ROW(1:99)))
ctrl+shift+enter结束
结果为:661.4629471
用时不超过3s。
全部回答
- 1楼网友:逃夭
- 2021-03-17 11:55
private sub command1_click()
for i = 1 to 99
s = s + sqr(i)
next
print format(s,"0.##")
end sub
- 2楼网友:动情书生
- 2021-03-17 11:10
Dim str As String, i As Integer
Dim a As Integer
For i = 1 To 99
If str = "" Then
str = Sqrt(i)
Else
str = str + Sqrt(i)
End If
Next
a = InStr(1, str, ".")
str = Mid(str, 1, a + 2)
TextBox1.Text = str
'已成功调试,答案为661.46
给面红旗吧...呵呵
- 3楼网友:老鼠爱大米
- 2021-03-17 10:26
Dim str As String, i As Integer
Dim a As Integer
For i = 1 To 99
If str = "" Then
str = Sqrt(i)
Else
str = str + Sqrt(i)
End If
Next
a = InStr(1, str, ".")
str = Mid(str, 1, a + 2)
TextBox1.Text = str
'已成功调试,答案为661.46
- 4楼网友:躲不过心动
- 2021-03-17 09:57
我写的程序,调试过的,正确。
#include
#include
int main()
{
float sum,i;
sum=0;
for(i=1;i<=55;i++)
sum+=sqrt(i);
printf("%.2f\n",sum);
return 0;
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯