编写程序,计算下面n(n∈N*)个数的和
问题描述:
编写程序,计算下面n(n∈N*)个数的和
2,3/2...(n+1)/n 用BASIC程序语言写出算法
答
Dim i as integer,n as integer,sum as integer input "the num is :";n sum = 0 for i = 1 to n sum = sum + (i+1)/i next i print "the sum is:";sum 楼上是VBasic的写法,我这个应该是QBasic的写法,比较古老,不知道楼主要的是哪个版本,好久没写QB了,不知道有没语法错误.