求下列分段函数的值,正确的程序有()。
A、#include <stdio.h> #include <math.h> int main() { float x,y; scanf("%f",&x); if (x<10) y="3-fabs(x);" else printf("y="%f\n",y);" return 0;> B、#include <stdio.h> #include <math.h> int main() { float x,y; scanf("%f",&x); if (x<10) y="3-fabs(x);" if (x>=10) y=sqrt(x)-2; printf("y=%f\n",y); return 0; }
C、#include <stdio.h> #include <math.h> int main() { float x,y; scanf("%f",&x); if (x<10) y="3-fabs(x);" else if (x>=10) y=sqrt(x)-2; printf("y=%f\n",y); return 0; }
D、#include <stdio.h> #include <math.h> int main() { float x,y; scanf("%f",&x); y=3-fabs(x); if (x>=10) y=sqrt(x)-2; printf("y=%f\n",y); return 0; }
第3题
计算分段函数值。下列程序段正确的是( )。
A、If x < 0 Then y = 0 If x < 1 Then y = 1 If x < 2 Then y = 2 If x >= 2 Then y = 3
B、If x >= 2 Then y = 3 If x >= 1 Then y = 2 If x > 0 Then y = 1 If x < 0 Then y = 0
C、If x < 0 Then y = 0 ElseIf x > 0 Then y = 1 ElseIf x > 1 Then y = 2 Else y = 3 End If
D、If x >= 2 Then y = 3 ElseIf x >= 1 Then y = 2 ElseIf x >=0 Then y = 1 Else y = 0 End If
第4题
求分段函数的值,正确的程序是( )。
A、x=input('x=:'); y=(x+10)*(x>0)+(x-10)*(x<=0);> B、x=input('x=:'); y=x+10; if x<=0 y="x-10;" end> C、x=input('x=:'); if x>0 y=x+10; else y=x-10; end disp(y)
D、x=input('x=:'); if x>0 y=x+10; elseif x<=0 y="x-10;" end>
第5题
【多选题】求分段函数的值,正确的程序是( )。
A、x=input('x=:'); y=(x+10)*(x>0)+(x-10)*(x<=0);> B、x=input('x=:'); y=x+10; if x<=0 y="x-10;" end> C、x=input('x=:'); if x>0 y=x+10; else y=x-10; end disp(y)
D、x=input('x=:'); if x>0 y=x+10; elseif x<=0 y="x-10;" end>
第6题
计算分段函数值。下列程序段正确的是______。
A、If x < 0 Then y = 0 If x < 1 Then y = 1 If x < 2 Then y = 2 If x >= 2 Then y = 3
B、If x >= 2 Then y = 3 If x >= 1 Then y = 2 If x > 0 Then y = 1 If x < 0 Then y = 0
C、If x < 0 Then y = 0 ElseIf x > 0 Then y = 1 ElseIf x > 1 Then y = 2 Else y = 3 End If
D、If x >= 2 Then y = 3 ElseIf x >= 1 Then y = 2 ElseIf x >=0 Then y = 1 Else y = 0 End If
第7题
用If语句表示分段函数,下列不正确的程序段是 。
A、If x >=1 Then f=Math.Sqrt(x+1) f=x*x+3
B、If x >=1 Then f= Math.Sqrt(x+1) If x < 1 Then f=x*x+3
C、f=x*x+3 If x >=1 Then f= Math.Sqrt(x+1)
D、If x < 1 Then f=x*x+3 Else f= Math.Sqrt(x+1) EndIf
E、f = Math.Sqrt(x+1) If x < 1 Then f=x*x+3
第8题
计算分段函数值,下列程序段正确的是______。
A、If x < 0 Then y = 0 If x < 1 Then y = 1 If x < 2 Then y = 2 If x >= 2 Then y = 3
B、If x >= 2 Then y = 3 If x >= 1 Then y = 2 If x > 0 Then y = 1 If x < 0 Then y = 0
C、If x < 0 Then y = 0 ElseIf x > 0 Then y = 1 ElseIf x > 1 Then y = 2 Else y = 3 End If
D、If x >= 2 Then y = 3 ElseIf x >= 1 Then y = 2 ElseIf x >=0 Then y = 1 Else y = 0 End If
第9题
计算分段函数值,下列程序段正确的是______。
A、If x < 0 Then y = 0 If x < 1 Then y = 1 If x < 2 Then y = 2 If x >= 2 Then y = 3
B、If x >= 2 Then y = 3 If x >= 1 Then y = 2 If x > 0 Then y = 1 If x < 0 Then y = 0
C、If x < 0 Then y = 0 ElseIf x > 0 Then y = 1 ElseIf x > 1 Then y = 2 Else y = 3 End If
D、If x >= 2 Then y = 3 ElseIf x >= 1 Then y = 2 ElseIf x >=0 Then y = 1 Else y = 0 End If
第10题
用If语句表示分段函数,下列不正确的程序段是 。
A、If x >=1 Then f=Math.Sqrt(x+1) f=x*x+3
B、If x >=1 Then f= Math.Sqrt(x+1) If x < 1 Then f=x*x+3
C、f=x*x+3 If x >=1 Then f= Math.Sqrt(x+1)
D、If x < 1 Then f=x*x+3 Else f= Math.Sqrt(x+1) EndIf
E、f = Math.Sqrt(x+1) If x < 1 Then f=x*x+3
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!