C Language Job 5

Source: Internet
Author: User

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 ("then they are in the order of %d%d%d", A,b,c); return 0;}

High speed penalty

#include <stdio.h>intMain () {DoubleA,b,c; printf ("Please enter your speed and this lane limit:"); scanf ("%LF%LF",&a,&b); if(b>a&&b<c) {DoubleC= (Double) A * (1+0.1); printf ("Penalty of 200 yuan penalty", c); }         Else(a>c) {DoubleC= (Double) A * (1+0.5); printf ("revoke a driver's license", c); }   return 0;} 

Taxi fare

#include <stdio.h>intMain () {Doublex, Y, Z printf ("Please enter total mileage:"); scanf ("%LF",&x); printf ("Please enter the waiting time:"); scanf ("%LF",&y); if(x<=3) {Z=Ten; }    if(x>3&&x<=Ten); {Z= -+ (X-Ten)*3; }    if(y<5&&x<=3) {Z=Ten; }    if(y<5&& (x>3&&x<=Ten) ) {Z= -+ (X-Ten)*3; }    if(y>=5&&x<=3) {Z= (y/5)*2+Ten; }    if(y>=5&& (x>3&&x<=Ten) ) {Z= (y/5)*2+ -+ (X-Ten)*3; }    return 0;}

Statistics on student achievement

#include <stdio.h>intMain () {Charscore; printf ("Please enter a level"); scanf ("%c",&score); Switch(score) { Case 'A': printf ("90-100");  Break;  Case 'B': printf ("80-89");  Break;  Case 'C': printf ("70-79");  Break;  Case 'D': printf ("60-69");  Break;  Case 'E': printf ("0-59");  Break; }    return 0;}

Triangle judgment and Perimeter area

#include <stdio.h>intMain () {intA,b,c; floatP,s; scanf (" %d%d%d",&a,&b,&c); if(a+b>c| | a+c>b| | B+c>a) {p= (a+b+c)/2; S=p* (P-A) * (p-b) * (P-c); printf ("s=%f\n", s)} Elseprintf"impossible\n"); return 0;}

Triangle

#include <stdio.h>intMain () {inti,j,k;  for(j=1; j<=Ten; j + +)    {         for(k=Ten;k>Ten-j;k--) {printf (" "); }         for(i=1; i<=Ten-j;i++) {printf ("*"); } printf ("\ n"); }    return 0;} 

Gee homework is more and more difficult, this assignment will not be too many places, I hope the teacher can be a lot of guidance, this C language is too difficult!!

C Language Job 5

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.