1.
#include <stdio.h>intMain () {intA,b,c; printf ("Please enter a total of 3 integers:"); scanf (" %d%d%d",&a,&b,&c); if(a<b && a<c && b<c) printf (" %d%d%d", A,b,c); if(B<a && b<c && a<c) printf (" %d%d%d", B,a,c); if(B<a && b<c && a>c) printf (" %d%d%d", B,c,a); if(C<a && c<b && a>b) printf (" %d%d%d", C,b,a); if(C<a && c<b && a<b) printf (" %d%d%d", c,a,b); if(a<b && a<c && b>c) printf (" %d%d%d", a,c,b); return 0;}
2.
#include <stdio.h>intMain () {intb; printf ("Please enter speed and speed limit:"); scanf ("%d%d",&a,&b); DoubleC= (Double) (A-B) * -/b; if(c<=Ten) printf ("No speeding"); Else if(c< -&& c>Ten) printf ("speeding, a fine of 200 yuan", c); Elseprintf ("severe speeding, revocation of driver's license", c); return 0;}
3.
#include <stdio.h>intMain () {Doublea,b,c,d; intT,n; printf ("Please enter mileage and wait time:"); scanf ("%lf%d",&a,&t); if(a<=3) C=Ten; Else if(a>3&& a<=Ten) C=Ten+2* (A-3); Else if(a>Ten) C= -+3* (A-Ten); if(t<5) {D=0; } Else if(t>=5) {n=t/5; D=n*2; } b=c+D; printf ("passengers should pay the fare as follows:%.lf\n", B); return 0;}
4.
#include <stdio.h>intMain () {inti,a,b,c,d,e,n,s; A=b=c=d=e=0; printf ("Enter N:"); scanf ("%d",&N); for(i=0; i<n;++i) {printf ("Enter Grade%d:", i+1); scanf ("%d",&s); Switch(s/Ten) { Case 1E Break; Case 2:D; Break; Case 3C Break; Case 4B Break; Case 5A Break; }} printf ("The number of A (90~100):%d\n", A); printf ("The number of B (80~89):%d\n", B); printf ("The number of C (70~79):%d\n", C); printf ("The number of D (60~69):%d\n", D); printf ("The number of E (0~59):%d\n", E); return 0;}
5. Look at the problem and make a mistake, ask the teacher to teach
6.
#include <stdio.h>int main () { int i,j; for (j=1; j<=; j + +) { for (i=1; i<=--j;i++) { printf (" *"); } printf ("\ n") ;
C Language Fifth time assignment