How to write a program that performs all mathematical operations on two variables

preview_player
Показать описание
OPERATORS:
Operators are the symbols that are used to perform certain operations on data. C++ provides a variety of operators. These include arithmetic operations, relational operators, logical operators, bitwise operators etc. The operators can be categorized as follows:

1) UNARY OPERATORS:
A type of operator that works with one operand is known as unary operators.
Following operators are used unary operators :
-,++,--
The above operators are used with one operand as follows:
-a;
N++;
--X;

2) BINARY OPERATORS:
A type of operator that works with two operand is known as binary operators.
Following operators are used unary operators :
+,-,*,/,%
The above operators are used with two operands as follows:
a+b;
x/y;

ARITHMETIC OPERATORS:
Arithmetic operators is a symbol that performs mathematical operation on data. C++ provides many arithmetic operators.
Following is a list of all arithmetic operators in c++:

OPERATORS SYMBOL DESCRIPTION
Addition + Adds two values
Subtraction - Subtracts one value from another value
Multiplication * Multiplies two values
Division / Divides one value from another value
Modulus % Gives the reminder of division of two integers

All arithmetic operators works with numeric values. suppose we have two variables A and B where A=10 and B=5.Arithmetic operators can be used on A and B as follows:

OPERATORS RESULTS
A+B 15
A-B 5
A*B 20
A/B 2
A%B 0

WATCH:-

C++ Program that explains the concept of overflow and underflow .

C++ program that input the radius of a circle & displays circumference by formula 2πR .

And dont forget to subscribe our channel .
Thanks for watching ......................... .
Рекомендации по теме
visit shbcf.ru