C语言实验——计算表达式
Time Limit: 1000MS Memory Limit: 65536KB
Problem Description
计算下列表达式值:

Input
输入x和n的值,其中x为非负实数,n为正整数。
Output
输出f(x,n),保留2位小数。
Example Input
3 2
Example Output
2.00
Hint
Author
参考代码
#include<stdio.h>
#include<math.h>
double f(double x,int n)
{
double y;
if(n == 1)
{
y = sqrt(n + x);
}
else
y = sqrt(n + f(x,n - 1));
return y;
}
int main()
{
double x;
int n;
double y;
scanf("%lf%d",&x,&n);
y = f(x,n);
printf("%.2lf\n",y);
return 0;
}