Arithmetic Operators in C Programming
Arithmetic Operators in C Programming
Introduction to Arithmetic Operators
Arithmetic operators in C programming are used to perform basic mathematical operations such as addition, subtraction, multiplication, and division. These operators are commonly used in almost every program.
Understanding arithmetic operators in C programming is important for performing calculations and solving problems.
List of Arithmetic Operators
Common Arithmetic Operators
+Addition-Subtraction*Multiplication/Division%Modulus (remainder)
Example of Arithmetic Operators
int main() {
int a = 10, b = 3;
printf(“Addition: %d\n”, a + b);
printf(“Subtraction: %d\n”, a – b);
printf(“Multiplication: %d\n”, a * b);
printf(“Division: %d\n”, a / b);
printf(“Modulus: %d\n”, a % b);
return 0;
}
Output Explanation
- Addition gives the sum of two numbers
- Subtraction gives the difference
- Multiplication gives the product
- Division gives the quotient (integer division)
- Modulus gives the remainder
Integer vs Float Division
Integer Division
printf(“%d”, a / b); // Output: 3
Float Division
printf(“%f”, a / b); // Output: 3.333333
Integer division removes decimal values, while float division gives precise results.
Using Arithmetic Operators with Variables
int main() {
int x = 5;
int y = 2;
int result = x * y + 10;
printf(“Result: %d”, result);
return 0;
}
Operator Precedence in C
Operator precedence defines the order in which operations are performed.
Order of Execution
*,/,%+,-
Example
Multiplication is performed before addition.
Why Arithmetic Operators are Important
Key Benefits
- Used in calculations
- Required for logic building
- Essential in real-world applications
- Helps in problem-solving
Start Learning C Programming
Practice arithmetic operations to strengthen your programming skills.
Summary
Arithmetic operators in C programming are used to perform mathematical operations. They include addition, subtraction, multiplication, division, and modulus.
FAQs
What are arithmetic operators in C?
They are operators used to perform mathematical operations.
What is the modulus operator?
It returns the remainder of a division.
What is the difference between / and %?
/ gives quotient, % gives remainder.
What is operator precedence?
It defines the order in which operations are executed.



