c语言求双精度浮点数的平均数
时间: 2024-06-13 16:07:49 浏览: 91
C语言各章程序题
以下是C语言求双精度浮点数平均数的代码示例:
```c
#include <stdio.h>
int main()
{
double num1, num2, avg;
printf("Enter two numbers: ");
scanf("%lf %lf", &num1, &num2);
avg = (num1 + num2) / 2;
printf("Average = %.2lf", avg);
return 0;
}
```
运行结果示例:
```
Enter two numbers: 3.5 4.5
Average = 4.00
```
阅读全文