explain the following operators
1 arithmetic operator
2 relational operator
Answers
Answer:
(a) Arithmetical Operator
Arithmetical operators are used to perform mathematical calculations in a program. These operators work in the same sequence in which they are used in mathematics.
For example- addition (A + B), subtraction (A - B).
(b) Relational Operator
A relational operator is used to determine the relationship between two or more operands. The relational operator checks the condition and returns the result in either 'true' or 'false' for further processing.
For example- less than (A < B), greater than (A > B).
(c) Logical Operator
Logical operators are needed to compare two or more expressions. These operators give result in 'true' or 'false', depending upon the outcome of the logical expressions.
For example:
AND ⇒ ((A = B) AND (B = C))
NOT ⇒ (NOT(A = B))
Answer:
- An arithmetic operator is a mathematical function that takes two operands and performs a calculation on them. They are used in common arithmetic and most computer languages contain a set of such operators that can be used within equations to perform a number of types of sequential calculation
- In computer science, a relational operator is a programming language construct or operator that tests or defines some kind of relation between two entities. These include numerical equality (e.g., 5 = 5) and inequalities (e.g., 4 ≥ 3). ... Relational operators can be seen as special cases of logical predicates.