猿问

编写计算VB

编写计算1+1/2+1/3+1/4+…..1/100的程序,把结果显示出来

慕姐8265434
浏览 399回答 2
2回答

LEATH

C#:int result=0;for(int i=0;i<=100;i++)rsult+=1/i;VB:Dim i as integer=1Dim result as integer=0for i to 100result+=1/i&nbsp;VB的不怎么记得语法了

临摹微笑

Dim&nbsp;i&nbsp;as&nbsp;integer Dim&nbsp;result&nbsp;as&nbsp;integer=1 For&nbsp;i=&nbsp;1&nbsp;To&nbsp;100&nbsp;Step&nbsp;1 result=result+&nbsp;1&nbsp;/i Next Console.WriteLine(result)
随时随地看视频慕课网APP
我要回答