C-programming - Arithmetic operators, C++ arithmetic operator

Arithmetic operators

Arithmetic operators

Arithmetic operators are used to form arithmetic statements which does the mathematical operations. Arithmetic operators supported in c++ are addition (+), subtraction (-), multiplication (*), division (/), modulo (%).

Operations of addition, subtraction, multiplication and division literally correspond with their respective mathematical operators whereas modulo is the operation that gives the remainder of a division of two values.

 

#include <iostream.h>
  int main( )
   {
    int x = 8;
    int y = 4;
    int a = x%y; 
    int b = x+y;
    int c = x-y;
    int d = x/y;
    cout  << "a:" << a << "b:" << b << "c:" << c << "d:" << d <<'\n' ;
    return 0;
   }


output


a = 0 b =12 c = 4 d = 2

The topic on C-programming - Arithmetic operators is posted by - Sathya

Hope you have enjoyed, C-programming - Arithmetic operatorsThanks for your time

Tech Bluff