1,JAVA编的,n可以任意赋值
public double fun(int n)
{double sum=0;
for(int i=1;i<=n;i++)
{sum+=1/((double)i*(i+1));}
return sum;}
2,JAVA编的
public void selectSort(int a[]) { //数组的选择排序
for (int n = a.length; n > 1; n--) {
int i = max(a, n);
int temp = a[i];
a[i] = a[n - 1];
a[n - 1] = temp;
}
}