C Language Fifth time assignment

Source: Internet
Author: User

Speeding fines

#include <stdio.h>intMain () {intx= -; intY//Speedprintf"speed of speeding:"); scanf ("%d",&y); if(y>1.1*x && y<1.5*x) {printf ("punished 200 Yuan"); }    if(y>1.5*x) {printf ("Revocation of license"); }

Compare size

#include <stdio.h>intMain () {inta,b,c,t; printf ("Enter 3 numbers:"); scanf (" %d%d%d",&a,&b,&c); if(a<b) {T=a;a=b;b=T; }    if(a<c) {T=a;a=c;c=T; }    if(b<c) {T=b;b=c;c=T; } printf ("The order is%d %d%d", A,b,c); return 0;

Fare

#include <stdio.h>intMain ()//Taxi Pricing{     intS,TIME,RMB; printf ("Please enter total mileage:"); scanf ("%LF",&x); printf ("Please enter the waiting time:"); scanf ("%LF",&y); if(time%5==0)     {         if(s<=0) RMB= (time/5)*2; Else if(s<=3) RMB=Ten+ (time/5)*2; Else if(s<=Ten) RMB=Ten+ (S-3)*2+ (time/5)*2; ElseRMB=Ten+(Ten-3)*2+ (S-Ten)*3+ (time/5)*2; }     Else      {        if(s<=0) RMB= (time/5+1)*2; Else if(s<=3) RMB=Ten+ (time/5+1)*2; Else if(s<=Ten) RMB=Ten+ (S-3)*2+ (time/5+1)*2; ElseRMB=Ten+(Ten-3)*2+ (S-Ten)*3+ (time/5+1)*2; } printf ("passenger payable%d $ \ n", RMB); return 0;}

Statistics on student achievement

#include <stdio.h>intMain () {intScore,n,i; inta,b,c,d,e; A=b=c=d=e=0; printf ("Please enter the number of students: \ n"); scanf ("%d",&N);  for(i=1; i<=n;i++) {printf ("Please enter the grade of%d students: \ n", i); scanf ("%d",&score); if(score>= -) A++; Else if(score>= the&& score< -) b++; Else if(score>= -&& score< the) C++; Else if(score>= -&& score< -) d++; Elsee++; } printf ("a:%d People, b:%d people, c:%d people, d:%d people, e:%d people \ n", a,b,c,d,e); return 0;

Triangle Judgment

#include <stdio.h>int  main () {    int n=, i,j;      for (i=0; i<n;i++)    {        for (j=0; j<=i;j++)        printf ("*" );        printf ("\ n");}    }
Statistics on student achievement
#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:". II1); 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;}

C Language Fifth time assignment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.