float f(float x,int n){if(n==0) return 1;else return x*f(x , n-1);}main(){intn=5; float x=2.0;printf(〝%f〞,f(x,n)); }
A: 16.00000
B: 8.00000
C: 32.00000
D: 64.00000
A: 16.00000
B: 8.00000
C: 32.00000
D: 64.00000
举一反三
- int main() { float x=3.6; int i; i=(int)x; printf("x=%f,i=%d\n",x,i); return 0; }
- 有如下函数:用递归方法求N阶勒让德多项式的值,递归公式为Pn值在n=0时为1,n=1时为x,n>;1时为((2n-1)*x*Pn—1(x)-(n-1)*Pn-2(x))/n#include<;stdio.h>;main(){ float pn();float x,lyd;int n;scanf("%d%f",&n,&x);lyd= (1)printf("pn=%f",lyd);}float pn(float x,int n){ float temp;if (n==0) temp= (2)else if (n==1) temp= (3)else temp= (4)return(temp);}
- 以下程序的功能是计算下面函数的值。请填空。 # include # include float f( float,float,float); int main( ) { float x,y,z,sum; printf("\ninput x,y,z:\n"); scanf("%f%f%f",&x,&y,&z); sum=( ); printf("sum= %f\n",sum); return(0); } float f(float a,float b,float c) { float value; value=( ); return(value); }2f4cdb578a913e638a60b2fa2096c3a4.png
- 以下程序运行后的输出结果是____________。#include<;stdio.h>;float f(float x,float y){ x+=1;y+=x;return y;}main(){float a=1.6,b=1.8;printf("%f\n ", f(b-a,a));}
- int max(float x , float y) { float z; z=x>y?x:y; return(z); } int main(){ float a=1.5,b=2.5,c; c=max(a,b); printf("max=%f\n",c); }