Basic arithmetic operators
The operators in the C language for basic arithmetic operations are: +,-,*,%,/. The use of these operators is essentially the same as you might imagine:
The addition operator "+" causes the values on both sides of it to be added together.
The subtraction operator "-" subtracts the subsequent number from the number preceding it.
multiplication is represented by "*" . The C language does not have a function to calculate squares, and there is no exponential operator. But you can use multiplication to calculate the square.
the symbol "%" means redundancy. The result of the remainder operation is the remainder after dividing two numbers. Therefore, the value of the participating operation must be an integer.
the symbol "/" denotes division. Note that the division operation of a floating-point type gets a floating-point number result, and the integer division operation gets an integer result.
For example, 5/2 results are 2. When you mix integers and floating-point numbers, the result is a floating-point number, such as the 5/2.0 result is 2.5.
Let's see an example:
C code
#include <stdio.h>
int Main (void)
{
int a = 7;
int b = 3;
//Ask A to divide by the remainder of B and output the remainder
//Write down your code here
printf ("%d", a%b);
return 0;
}
The result of course is 1, more study content, in the code bud Net Http://www.mayacoder.com/lesson/index
C Language Basic Learning operator-Basic arithmetic operator