题目内容

若运行以下程序时输入:3 5/<回车>,则程序的运行结果是 。#include int main(){ float x,y;char o;double r;scanf("%f %f %c",&x,&y,&o);switch(o){case '+':r=x+y;break;case '-':r=x-y;break;case '*':r=x*y;break;case '/':r=x/y;break;}printf("%f",r);return 0;}

查看答案
更多问题

以下程序的输出结果是 。#include int main(){ int a=2,b=7,c=5;switch(a>0){case 1:switch(b<0){case 1:printf("@");break;case 2:printf("!");break;}case 0:switch(c==5){case 0:printf("*");break;case 1:printf("#");break;default:printf("#");break;}default:printf("&");}printf("\n");return 0;}

以下程序的输出结果是 。#include int main(){ int x,y;x=5switch(x){case 1:case 2:case 3:case 4: printf("x<5\n");case 5: printf("x=5\n",x);default:printf("The value of x is unknown.\n");}return 0;}

若运行以下程序时输入:6 3 1<回车>,则程序的运行结果是 。#include #include int main ( ){double a,b,c,disc,x1,x2,p,q;scanf("%lf%lf%lf",&a,&b,&c);disc=b*b-4*a*c;if (disc<0)printf("This equation hav't real roots\n");else{ p=-b/(2.0*a);q=sqrt(disc)/(2.0*a);x1=p+q;x2=p-q;printf("real roots:\nx1=%7.2f\nx2=%7.2f\n",x1,x2);}return 0;}

若运行以下程序时输入:2 4 1<回车>,则程序的运行结果是 。#include #include int main ( ){double a,b,c,disc,x1,x2,p,q;scanf("%lf%lf%lf",&a,&b,&c);disc=b*b-4*a*c;if (disc<0)printf("This equation hav't real roots\n");else{ p=-b/(2.0*a);q=sqrt(disc)/(2.0*a);x1=p+q;x2=p-q;printf("real roots:\nx1=%7.2f\nx2=%7.2f\n",x1,x2);}return 0;}

答案查题题库