2. 编C语言程序计算下面的函数: x 0<x<1 y= |x|+2 3≤x≤4 sin(x2 ) 当 x 取其他值时
时间: 2023-05-26 10:04:05 浏览: 71
#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语言编程序计算下面的函数: 0<x<1 y=x 3≤x≤4 y= |x|+2 当 x 取其他值时 y=sin(x 2 )
```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;
}
```
用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;
}
相关推荐
![ppt](https://img-home.csdnimg.cn/images/20210720083527.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://img-home.csdnimg.cn/images/20210720083646.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)
![](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)