What is arithmetic operators in C

Interview Questions
  • 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.

Operator Description Syntax Example
+ 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).

For Example
(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).

Relational Operator Example Description
> 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


Related Topics
What is logical operator in C
What is bitwise operator in C
What is conditional operator and it's syntax in C
What is the difference between pre (--var) and post(var--) decrement operator.
Why is default statement used in switch case in C
What is the difference between constant and variable in C
What is Dangling Pointer in C.
What are advantages and disadvantages of Arrays in C.
What is size of a pointer variable
What are the various ways of passing arguments to a function in C.