#include
int main()
{
int a,b,sum;//one , define variables, int represents data type - integer, sum sum;
printf("Please enter two integers:");
scanf("%d %d" ,&a,&b);//2. Input data, %d’s restriction on the input type represents an integer, and these two numbers are given to the two variables &a and &b respectively, &address operator;
sum=a+b;//3. Data processing, assign the sum of a and b to sum;
printf("The sum of these two numbers is: %d\n", sum); // Fourth, output the result, %d outputs an integer, this number is sum;
printf("Complete calculation, thank you for using!");
return 0; //Return;
}
Extended information:
C language writing rules:
1. One description or statement occupies one line .
2. The part enclosed by {} usually represents a certain hierarchical structure of the program. {} is generally aligned with the first letter of the structural statement and occupies a separate line.
3. Statements or explanations at a lower level can be written with a certain number of spaces indented compared to statements or explanations at a higher level. In order to look clearer and increase the readability of the program. You should strive to follow these rules when programming to develop a good programming style.
Reference materials:
Baidu Encyclopedia-c language