printf(\结果为%.4f\\n\ return 0;
}
6.7
# include
printf(\请输入变量n: \
scanf(\ s = 0;
for( i=1; i <= n; i++) { s += 1 / ( (i + 1) * (float)i ); // }
printf(\结果为%f\\n\ return 0;
} 6.8
# include
int main(void)
强制转换 { }
double fun(int n) { } 6.9
#include
printf(\请输入原始数据:\\n\ for(i=0;i {printf(\ printf(\排序前的数据如下所示:\\n\ for(i=0;i double s; int i; s=0.0; for(i=1; i<=n; i++) { } return s; s +=1.0 /(2*i-1) - 1.0 /(2*i) ; int n; double sum; printf(\请输入变量n: \scanf(\sum = fun(n); printf(\结果为: %f\ for(i=0;i for(j=i+1;j } printf(\排序后的数据如下所示:\\n\ for(i=0;i 10.编程序,应用冒泡法对通过键盘输入17个整数 按照从大到小的顺序排序,并输出排序前后的数据 */ # include void maxtomin(int [], int n); int main(void) { int a[N]; int i,j,temp; printf(\输入%d个整数,空格隔开:\\n\ return 0; } for( i=0; i scanf(\ for( i=0; i for( j=0; j if( a[j] < a[j+1] ) { } temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; printf(\结果为:\\n\for(i=0; i printf(\ return 0; 6.11 # include int fun(int); int main(void) { } int fun(int x) int x; printf(\输入x的值: \scanf(\ printf(\结果为: %d\\n\