Advertisements
Advertisements
Question
What are arithmetic operators in C++? Differentiate unary and binary arithmetic operators. Give example for each of them.
Advertisements
Solution
Arithmetic operators: perform simple arithmetic operations like addition, subtraction, multiplication, division, etc.
Unary Operators:
- Require only one operand.
- Example: +, -, *, /, %, >, <, <=, AND, OR
Binary Operators:
- Require two operands
- Example: ++ (Plus, Plus) Increment operator, – – (Minus, Minus) Decrement operator, NOT, ~,
APPEARS IN
RELATED QUESTIONS
Which of the following operator is an extraction operator in C++?
What are keywords?
Can keywords be used as identifiers?
The following constant is of which type?
04.14
Write the following real constant into the exponent form:
0.00005
Assume n = 10; what will be result of n++ and --n;?
Is C++ case sensitive? What is meant by the term “case sensitive”?
What is the difference between 56L and 56?
Determine which of the following are valid constant? And specify their type.
‘Name’
Determine which of the following are valid constant? And specify their type.
‘\t’
