Sub-Number of Han number & #183; C Language -- let C help you with computation, C language Calculator

Source: Internet
Author: User

Sub-Number of Han · C Language -- let C help you with computation, C language Calculator

Before that, we learned our first C program-hello World. Now let's start to learn more and think about how to make C help you with computation.

Let's first look at the code (I haven't created a new one, or use the previous hello world. cpp ):

Okay, because I have learned the basic C framework before hello World, so I will not repeat the content I mentioned before.

Then let's take a look at the notes:

1. row 4: int is the key word of C. It can be used to define variables. In addition to int, it can also be used to define variables such as char and float. This will be detailed when we talk about the data type.

2. the fifth line: scanf is a format input statement, which is the opposite of printf and has the same usage. "% d, % d" "is used to represent the input format, where ', 'indicates the separation method, and & a and & B indicates to whom the input value is assigned. These can be customized.

3. Row 6: This is too simple. Although this article is intended to make pupils understand it, I don't think I need to explain it.

4. Row 7: the syntax of this line is not described much as we mentioned above.

Finally, let's talk about the computing that can be run in C language?

In addition to addition, subtraction, multiplication, and Division (+-*/), there are also values (=), remainder (%), power (^), and negative (-) the difference between it and minus sign is that it only targets one number, as well as auto-Plus (++) and auto-minus (--).

For example, I ++ is equivalent to I = I + 1, and I -- is equivalent to I = I-1.

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.