5.5 lude nain( scanf("%f, &x) if(x<10) i if(x<1) y-x, y printf("%f\n"y) fint x, y: scanf("%d", &x) 10 switch(y) case 9: printf("An"); break case 8: printf("B\n"); break case 7: printf("C\n"); break case 6: printf("Dn"), break default: printf ("EIn"); break
5.5 #include void main() { float x,y; scanf("%f",&x); if(x void main() {int x,y; scanf("%d",&x); y=x/10; switch(y) { case 10 : case 9:printf("A\n");break; case 8:printf("B\n");break; case 7:printf("C\n");break; case 6:printf("D\n");break; default:printf ("E\n");break; } }
lude maino scanf("%f, %f, %f, &a, &b, &c) if(a>b)x=a else xb if(x>c)y=x else printf("%5.2f\n"y)
1.6 #include void main() {float a,b,c,x,y; scanf("%f,%f,%f",&a,&b,&c); if(a>b) x=a; else x=b; if(x>c) y=x; else y=c; printf("%5.2f\n",y); }
4.9 lude maino scanf("%f", &F) c=5*(F-32)/9 printf("%5.2f\n",c)
4.9 #include void main() {float F,c; scanf("%f",&F) ; c=5*(F-32)/9; printf("%5.2f\n",c); }
2.4(5) scanf("%d", &n) t=n%3 if(t=0) {i=n%5 if(i=o) printf("%d can", n); printf("%d can't", n) else printf("%d cant", n)
2.4(5) #include void main() {int n,t,i; scanf("%d",&n); t=n%3; if(t=0) {i=n%5; if(i=0) printf("%d can",n); else printf("%d can't",n); } else printf("%d can't",n); }
59解法 #include oid main( int a, b, c, d t scanf("%d, %d, %d, %d", &a, &b, &c, &d) Fa; a=c; c=t; it=a; a=d; d=t; j if(b>c) it=bb=c; c=t f(b>d it=bb=dd=t if(c>d ft=c; c=dd=t; 3 printf("%d, %d, %d, %d\n", a, b, c, d), 解法二 oid maino int a[4 printf("input 4 numbers: In"); a[i+ID) a[=a[+1 printf("the sorted numbers: n") for(i=0;i<4;i++ printf("%d, a[); printf("n );
5.9 解法一 #include void main() { int a,b,c,d,t; scanf("%d,%d,%d,%d",&a,&b,&c,&d); if(a>b) {t=a;a=b;b=t;} if(a>c) {t=a;a=c;c=t;} if(a>d) {t=a;a=d;d=t;} if(b>c) {t=b;b=c;c=t;} if(b>d) {t=b;b=d;d=t;} if(c>d) {t=c;c=d;d=t;} printf("%d,%d,%d,%d\n",a,b,c,d); } 解法二 #include void main() { int a[4]; int i,j,t; printf("input 4 numbers:\n"); for(i=0;ia[i+1]) { t=a[i]; a[i]=a[i+1]; a[i+1]=t; } printf("the sorted numbers:\n"); for(i=0;i<4;i++) printf("%d,",a[i]); printf("\n"); }