0% found this document useful (0 votes)
2 views

C++ 4

The document provides an overview of arithmetic operators used in programming, including addition, subtraction, multiplication, division, modulus, increment, and decrement. Each operator is described with its function and accompanied by example code snippets. The document serves as a reference for understanding how to perform basic mathematical operations in code.

Uploaded by

Hack Fin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

C++ 4

The document provides an overview of arithmetic operators used in programming, including addition, subtraction, multiplication, division, modulus, increment, and decrement. Each operator is described with its function and accompanied by example code snippets. The document serves as a reference for understanding how to perform basic mathematical operations in code.

Uploaded by

Hack Fin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Arithmetic Operators

Arithmetic operators are used to perform common mathematical operations.

Operator Name Description Example Try it

+ Addition Adds together two values x+y Try it »

- Subtraction Subtracts one value from another x-y Try it »

* Multiplication Multiplies two values x*y Try it »

/ Division Divides one value from another x/y Try it »

% Modulus Returns the division remainder x%y Try it »

++ Increment Increases the value of a variable ++x Try it »


by 1

-- Decrement Decreases the value of a variable --x Try it »


by 1

Addition
int main() {
#include <iostream> int x = 5;
using namespace std; int y = 3;
cout << x + y; #include <iostream>
return 0; using namespace std;
}
int main() {
Subtraction int x = 5;
int y = 2;
#include <iostream> cout << x % y;
using namespace std; return 0;
}
int main() {
int x = 5;
int y = 3; Increment
cout << x - y;
return 0;
} #include <iostream>
using namespace std;
Multiplication
int main() {
#include <iostream> int x = 5;
using namespace std; ++x;
cout << x;
int main() { return 0;
int x = 5; }
int y = 3;
cout << x * y;
return 0; Decrement
}
#include <iostream>
Division using namespace std;

#include <iostream> int main() {


using namespace std; int x = 5;
--x;
int main() { cout << x;
int x = 12; return 0;
int y = 3; }
cout << x / y;
return 0;
}

Modulus

You might also like