VB.NET代码: dim i,n as Long dim s as Double n=Console.ReadLine() s=0.0 for i=n to 1 step -1 s=s+1.0/i next i Console.WriteLine("s={0:e}",s) Console.WriteLine("s={0:g}",s)