# Arithmetic operators

In C++ there are the usual arithmetic operators as in most other programming languages, namely addition, subtraction, multiplication, division and the remainder operator (modulo). In addition, there are the one-digit operators for positive and negative sign.

## Code Explanation

``````#include &lt;iostream&gt;
#include &lt;iomanip&gt;	// Library for specifying the decimal places
using namespace std;

int main() {
int a = 4, b = 6;
long c = 7;
double z = 0;
cout << "Starting values" << endl;
cout << "a = " << a << "\nb = " << b << "\nc = " << c << endl;

cout << "Calculations" << endl;
z = (double)a / (double)b;
// setprecision() = Funktion from library <iomanip>,
// for specifying the decimal places
cout << "z = a / b = " << setprecision(2) << z << endl;

if (a % 2 == 0) {
cout << "Number " << a << " = even" << endl;
} else {
cout << "Number " << a << " = odd" << endl;
}
}``````
##### Output
``````Starting values
a = 4
b = 6
c = 7
Calculations
z = a / b = 0.67
Number 4 = even``````