C-language third time job

Source: Internet
Author: User
Tags pow

1, 10 rows of triangles

#include <stdio.h>intMain ()//10-row Triangle{printf ("*\n"); printf ("* *\n"); printf ("* * *\n"); printf ("* * * * *\n"); printf ("* * * * * *\n"); printf ("* * * * * * *\n"); printf ("* * * * * * * *\n"); printf ("* * * * * * * * * *\n"); printf ("* * * * * * * * * * *\n"); printf ("* * * * * * * * * * * *\n"); return 0;}

2, 10 lines *, print 10 * numbers per line

#include <stdio.h>intMain ()//10 row 10 column Rectangle{printf ("* * * * * * * * * * * *\n"); printf ("* * * * * * * * * * * *\n"); printf ("* * * * * * * * * * * *\n"); printf ("* * * * * * * * * * * *\n"); printf ("* * * * * * * * * * * *\n"); printf ("* * * * * * * * * * * *\n"); printf ("* * * * * * * * * * * *\n"); printf ("* * * * * * * * * * * *\n"); printf ("* * * * * * * * * * * *\n"); printf ("* * * * * * * * * * * *\n"); return 0;}

3, 10 rows Inverted triangle

#include <stdio.h>intMain ()//10-row inverted triangular shape{printf ("* * * * * * * * * * * *\n"); printf ("* * * * * * * * * * *\n"); printf ("* * * * * * * * * *\n"); printf ("* * * * * * * *\n"); printf ("* * * * * * *\n"); printf ("* * * * * *\n"); printf ("* * * * *\n"); printf ("* * *\n"); printf ("* *\n"); printf ("*\n"); return 0;}

4, five grade results (a~e) output corresponding percentile score (0~100) interval

#include <stdio.h>intMain ()//five grades (a~e), output corresponding percentile score (0~100) interval{    Charscore; 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;}

5, Fahrenheit temperature conversion Celsius temperature

#include <stdio.h>intMain ()//Fahrenheit temperature conversion Celsius temperature{    intC; intF; printf ("input Fahrenheit temperature:"); scanf ("%d",&F); C=5* (f +)/9; printf ("%d", C); return 0;}

6,100-meter free-falling program

#include <stdio.h>#include<math.h>int main ()//100 m freefall {     int g=, t=3;     Double h;            H=0.5*g*pow (t,2);    printf ("%f\n", h);     return 0 ;}

7, the value of the single-digit, 10-digit, and hundred digits of the output integer

#include <stdio.h>intMain ()//Single-digit , 10-digit, and hundred-digit values for output integers{    intA; scanf ("%d",&a);  while(a!=0) {printf ("%d\n", a%Ten); A=a/Ten; }    return 0;}

8, segmented function

#include <stdio.h>#include<math.h>intMain ()//segment Function{    Doublex; Doubley; scanf ("%LF",&x); if(x>=0) y=sqrt (x); Elsey=pow (x+1,2)+2*x+1/x; printf ("f (x) =%.2f", y); return 0;}

9, calculate interest on deposit

#include <stdio.h>#include<math.h>intMain ()//calculate interest on deposit{    intmoney,year; Doublerate,interest; printf ("Enter deposit Amount:"); scanf ("%d",&Money ); printf ("Input Storage period:"); scanf ("%d",&Year ); printf ("Enter annual interest rate:"); scanf ("%LF",&Rate ); Interest=money*pow (1+rate,year)-Money ; printf ("interest=%.2f\n", interest); return 0;}

10, Ladder Tariff

#include <stdio.h>intMain ()//price of ladder electricity{    floatN; printf ("Monthly electricity consumption:"); scanf ("%f",&N); if(n<= -) printf ("Monthly electricity bill:%f\n"N0.53); Elseprintf ("Monthly electricity bill:%f\n", -*0.53+ (n -)*(0.53+0.05)); return 0;}

C-language third time job

Related Article

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.