题目内容
3. 根据如图所示的函数关系,对输入的每个x值,计算出相应的y值。x yx < 000 <= x < 10x10 <= x < 201020 <= x < 40 -0.5x + 20main() {int x, c, m;float y;scanf(“%d”, &x);if ( ____________________ ) c = -1;else ____________________;switch (c) {case -1: y = 0; break;case 0: y = x; break;case 1: y = 10; break;case 2:case 3: y = -0.5 * x + 20; break;default: y = -2; // y =-2,表示输入非法}if (y != -2) printf(“y = %f”, y);else printf(“error \n”);}
查看答案
搜索结果不匹配?点我反馈