mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-12-16 15:44:39 +00:00
37 lines
713 B
Markdown
37 lines
713 B
Markdown
# 6-3 求两数平方根之和
|
||
|
||
函数fun的功能是:求两数平方根之和,作为函数值返回。例如:输入12和20,输出结果是:y = 7.936238。
|
||
|
||
### 函数接口定义:
|
||
```c++
|
||
double fun (double *a, double *b);
|
||
```
|
||
|
||
其中 `a `和 `b `是用户传入的参数。函数求 `a `指针和` b` 指针所指的两个数的平方根之和,并返回和。
|
||
|
||
### 裁判测试程序样例:
|
||
```c++
|
||
#include<stdio.h>
|
||
#include <math.h>
|
||
double fun (double *a, double *b);
|
||
int main ( )
|
||
{ double a, b, y;
|
||
scanf ("%lf%lf", &a, &b );
|
||
y=fun(&a, &b); printf ("y=%.2f\n", y );
|
||
return 0;
|
||
}
|
||
|
||
|
||
/* 请在这里填写答案 */
|
||
```
|
||
|
||
### 输入样例:
|
||
```in
|
||
12 20
|
||
```
|
||
|
||
### 输出样例:
|
||
```out
|
||
y=7.94
|
||
```
|