c语言编程序计算下面的函数: 0<x<1 y=x 3≤x≤4 y= |x|+2 当 x 取其他值时 y=sin(x 2 )
时间: 2023-09-05 20:10:04 浏览: 44
```c
#include <stdio.h>
#include <math.h>
int main()
{
double x, y;
printf("请输入x的值:");
scanf("%lf", &x);
if (x > 0 && x < 1) {
y = x;
} else if (x >= 3 && x <= 4) {
y = fabs(x);
} else {
y = sin(x * x);
}
printf("y的值为:%.2lf\n", y);
return 0;
}
```
相关问题
2. 编C语言程序计算下面的函数: x 0<x<1 y= |x|+2 3≤x≤4 sin(x2 ) 当 x 取其他值时
#include <stdio.h>
#include <math.h>
int main() {
double x, y;
printf("请输入x的值:");
scanf("%lf", &x);
if (x > 0 && x < 1) {
y = fabs(x);
} else if (x >= 3 && x <= 4) {
y = sin(pow(x, 2));
} else {
y = 0;
}
printf("y的值为:%.2lf\n", y);
return 0;
}
用c语言编写程序:计算下面的函数: x 0<x<1 y= |x|+2 3≤x≤4 sin(x2 ) 当 x 取其他值时
#include <stdio.h>
#include <math.h>
int main() {
double x, y;
printf("请输入x的值:");
scanf("%lf", &x);
if (x > 0 && x < 1) {
y = fabs(x);
} else if (x >= 3 && x <= 4) {
y = sin(x * x);
} else {
y = 0;
}
printf("y的值为:%.2lf", y);
return 0;
}
相关推荐
![c](https://img-home.csdnimg.cn/images/20210720083646.png)
![c](https://img-home.csdnimg.cn/images/20210720083646.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)