Maths Operator

In programming it is essential to have the basic knowledge of Mathematics like addition, subtraction, multiplication and so. In short know about the maths operator. This are the following Math operator that you should know:

  • + → addition operator
  • → subtraction operator
  • * → multiplication operator
  • / → division operator.
    If you use division operator on 2 integer variable you will get another integer variable regardless of the reminder. Usually integer variables will ignore the remainder. However, if you use 2 double or float variables you will get another double or float variable with the reminder as the data type accepts reminder.
  • % → modulo operator.
    Modulo operator is the same as division operator but it will only give the reminder of the 2 variables. For example 8 % 3 = 2, 7 % 5 = 2
mathoperator
The code for Math operator

Leave a comment