顺序结构与逻辑运算(5)
时间:2025-02-21
时间:2025-02-21
4-1-b该程序正确的源程序代码(或窗口截图): #include<stdio.h> main() { int a,b,d,x; scanf("%d%d%d",&a,&b,&d); switch (a) {
case 10 :x = a - b;break; case 11 :x = a * b ; break; default : x = a + b ; }
printf("%d\n",x); }
运行结果画面:
4-1-c该程序正确的源程序代码(或窗口截图): #include<stdio.h> main() { int a,b,x; scanf("%d%d",&a,&b); switch ( a+b )
{ case 10 : x = a+b;printf("%d\n",x); break; case 11 : x = a-b;printf("%d\n",x); break; default:printf("\n",x); } }
运行结果画面: