C++ Arithmetic Operators
Arithmetic Operators use to perform Arithmetic( + , - , * , /, % ) tasks between two or more numbers like Addition , Subtraction , Multiplication , Division and Remainder.
+ Operator also use to concatenation of strings and it will add 2+2 = 4 between numbers
In below example we'll use all basic Arithmetic Operators to perform basic tasks.
+ Operator also use to concatenation of strings and it will add 2+2 = 4 between numbers
In below example we'll use all basic Arithmetic Operators to perform basic tasks.
Simple Example of Arithmetic Operators
Example
Arithmetic Operators
- #include <iostream>
- using namespace std;
- int main(){
- int x = 10 ;
- int y = 5 ;
- cout <<" X + Y = " << ( x + y ) << endl ;
- cout <<" X - Y = " << ( x - y ) << endl ;
- cout <<" X * Y = " << ( x * y ) << endl ;
- cout <<" X / Y = " << ( x / y ) << endl ;
- cout <<" X % Y = " << ( x % y ) << endl ;
- return 0;
- }
Console :
X + Y = 15
X - Y = 5
X * Y = 50
X / Y = 2
X & Y = 0
Comments
Post a Comment