#include<stdio.h> #include<math.h> #define PI 3.14 int main() { float x,y; scanf("%f",&x); if(x<-PI) y=sqrt(PI*x+x*x)/2; else if(x>=PI) y=sqrt(PI*x-x*x)/2; else y=2*(1+cos(x)); printf("%.3f",y); }
输出结果是这样的
第九行你是不是想写<=,但是写错了呢
第九行写错了哦