47、函數fun的功能是:輸出a所指數組中的前n個數據,要求每行輸出5個數。
請在程序的下劃線處填入正確的內容并把下劃線刪除,使程序得出正確的結果。
注意:源程序存放在考生文件夾下的BLANK1.C中。
不得增行或刪行,也不得更改程序的結構!
#include
#include
void fun( int *a, int n )
{ int i;
for(i=0; i
{
/**********found**********/
if( ___1___==0 )
/**********found**********/
printf("___2___");
/**********found**********/
printf("%d ",___3___);
}
}
main()
{ int a[100]={0}, i,n;
n=22;
for(i=0; i
fun( a, n);
printf("\n");
}
48、給定程序中,函數fun的功能是計算下式
例如,若形參e的值為1e-3,函數的返回值2.985678。
請在程序的下劃線處填入正確的內容并把下劃線刪除,使程序得出正確的結果。
注意:源程序存放在考生文件夾下的BLANK1.C中。
不得增行或刪行,也不得更改程序的結構!
#include
double fun(double e)
{ int i; double s, x;
/**********found**********/
s=0; i=__1__;
x=1.0;
while(x>e){
/**********found**********/
__2__;
/**********found**********/
x=(2.0*i-1)/((__3__)*(2.0*i));
s=s+x;
}
return s;
}
main()
{ double e=1e-3;
printf("\nThe result is: %f\n",fun(e));
}