Blog Introductions
In this blog contains tutorials about HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials, Examples, Source code,Learning,Tips and Software development services. C++ Operators and Variable Operation | C++ tutorials Bestitworrior
C++ Operators and C++ Variable Operation
Operators use to perform operation on variables.C++ perform addition , multiplication, subtraction , division , modulus , Increment and decrement.By Using givien operators we perform certain operations on variables
Some Key Points of C++ Operators
- Operators use to perform operation on variables.
- C++ perform '+' Addition to add togeather two values x+y.
- C++ perform '-' Subtraction to subtract two values x-y.
- C++ perform '*' Multiplication to Multiply togeather two values x*y.
- C++ perform '/' Division to divide two values x/y.
- C++ perform '%' Modulus return division remender x%y.
- C++ perform '++' Increment to increase the value by 1.
- C++ perform '--' Decrement to decrese the value by 1.
Code
#include <iostream>
using namespace std;
int main() {
int var1 = 200;
int var2 = 100;
int add,sub,div,mul,modulus;
add = var1 + var2;
sub = var1 - var2;
div = var1 / var2;
mul = var1 * var2;
modulus = var1 % var2;
cout<<add;
cout<<endl;
cout<<sub;
cout<<endl;
cout<<div;
cout<<endl;
cout<<mul;
cout<<endl;
cout<<modulus;
cout<<endl;
return 0;
}
OutPut
300
100
2
20000
0
100
2
20000
0
0 Comments