- What is arithmetic operators in C
- What is assignment operators in C
- What is the relational operators in C
What is arithmetic operators in C
C Arithmetic operators are used to perform mathematical operations. There are five fundamental arithmetic operators supported by C language, which are addition(+),
subtraction(-), multiplication(-), division(/) and modulus(%) of two numbers.
All arithmetic operators compute the result of specific arithmetic operation and returns its result.
|+||Adds two numbers||a + b||15 + 5 = 20|
|-||Subtracts two numbers||a - b||15 - 5 = 10|
|*||Multiplies two numbers||a * b||15 * 5 = 75|
|/||Divides numerator by denominator||a / b||15 / 5 = 3|
|%||Returns remainder after an integer division||a % b||15 % 5 = 0|
What is assignment operators in C
Assignment Operators of C is used to assign a value to a variable. "=" is called simple arithmetic operator of C, it assigns values from right side operands(R value)
to left side operand (L value).
The general syntax of assignment operator is:
variable_name = expression;For Example
value = 1234;
value = 4/2;
What is the relational operators in C
Relational Operators are used to compare two values in C. It specifies the relation between two values like equal, greater than, less than etc. Relational operators always returns boolean value (zero for false and non-zero value for true).
(A > B) : It checks whether A is greater than B or not. It will return none-zero(true) if A is greater than B otherwise zero(false).
|>||A > B||Checks if A is greater than B|
|<||A < B||Checks if A is less than B|
|>=||A >= B||Checks if A is greater than or equal to B|
|<=||A <= B||Checks if A is less than or equal to B|
|==||A == B||Checks if A is equal to B|
|!=||A != B||Checks if A is not equal to B|