由于数组下标默认是0开始的.n个数组的下标是从0到n-1 if n mod=0 then '即数组个数为偶数个 for i=0 to n/2-1 temp=a(i) a(i)=a(n-i-1) a(n-i-1)=temp next i else '数组为奇数个,那么中间一个,不需要交换 for i=0 to (n-1)/2-1 temp=a(i) a(i)=a(n-i-1) a(n-i-1)=temp next i end if 如果下标从1开始,那么交换的就是a(i)与a(n+1-i),代码变成: if n mod=0 then '即数组个数为偶数个 for i=1 to n/2 temp=a(i) a(i)=a(n+1-i) a(n+1-i)=temp next i else '数组为奇数个,那么中间一个,不需要交换 for i=1 to (n-1)/2 temp=a(i) a(i)=a(n+1-i) a(n+1-i)=temp next i end if