Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Enter two integers and perform four operations of addition, subtraction, multiplication and division. How to write a C language program? Please ~
Enter two integers and perform four operations of addition, subtraction, multiplication and division. How to write a C language program? Please ~
password

# include & ltstdio.h & gt

int main()

{

int a,b;

Scanf("%d %d ",&i, & b);

printf("%d\t ",a+b);

printf("%d\t ",a-b);

printf("%d\t ",a * b);

printf("%d\t ",a/b);

Returns 0;

}

Run screenshots to analyze that addition, subtraction, multiplication and division in C language are the same as addition, subtraction, multiplication and division in mathematics. The difference lies in the representation of symbols, and multiplication symbols need to be represented by "*". The division symbol needs to be represented by "/". When beginners learn C language, it is easy to confuse division and remainder. Emphasize that the remainder is "%",and the percent sign indicates the remainder. Therefore, after inputting two integers, the result can be directly output according to the mathematical method, and the input of integers uses the scanf () function.