Arithmetic operator in c++

Arithmetic Operators

There are five types of arithmetic operators in C++. Arithmetic operators are binary operators as they take two operands. 

  • Addition (+)
  • Subtraction (-)
  • Multiplication (*)
  • Division (/)
  • Modulus (%)

Precedence of operators

Precedence of operators means that which arithmetic operator has higher precedence to execute and which operator has lower precedence. As division and multiplication has higher priority to execute then subtraction and addition. 

Write a C++ Program to use all arithmetic operators. Get two numbers from user, add them, subtract 2nd number from 1st number, multiply both numbers, divide them and get modulus of both numbers:-

arithmetic operator
Arithmetic operator

Output

arithmetic operator output
Arithmetic operator output


Comments