Basic review of C language

Source: Internet
Author: User
Tags greatest common divisor

The types of values we use in general are: shaping and floating-point type

Int

Double, float

In the calculation we should pay attention to defining variables, shaping the calculation back to integer, and floating-point calculation will retain 6 decimal places (general)

1, note the floating-point input and output format symbol a little difference: the input is:%LF output:%f,

eg

scanf (%lf,&a);//input

printf (%f,a);//Output


Basic calculation structure:

If If...else if the If branch is less, use a single outlet is better, the pattern design is the same, such as frame: thinkphp is also a single entrance, export

Switch...case default: Many times, we should be good at and If......else statements to convert, such as through the related method to convert If...else statements

Looping statements

While first judge, after content execution body

Do While the content body executes, and then judge

for a loop with a base

Note Keywords:

Continue: This is the end of the cycle, in the next cycle (do not jump out of the loop body, but this time the loop does not go to the following)

Break: ends the loop, jumps out of the current loop, and does not jump out of all loops.


Notice the nesting relationship in the loop, which is the problem of design to complexity

Frequently-given examples:

Find the prime, change, sum, greatest common divisor, inverse number



Summarize:

1, the structure of the basic program

2, the structure between the characteristics and continuous, their difficulty between the increment, the use of the scene.




Here is a picture of the design to the knowledge point:






















Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Basic review of C language

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.