-
Notifications
You must be signed in to change notification settings - Fork 2
/
Arithmetic_operator.cpp
48 lines (37 loc) · 1.14 KB
/
Arithmetic_operator.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Arithmetic Operator
#include <iostream>
using namespace std;
int main()
{
int num1{200};
int num2{100};
int result{0};
// Addition
result = num1 + num2;
cout << num1 << " + " << num2 << " = " << result << endl;
// Substraction
result = num1 - num2;
cout << num1 << " - " << num2 << " = " << result << endl;
// Multiplication
result = num1 * num2;
cout << num1 << " * " << num2 << " = " << result << endl;
// Division
result = num1 / num2;
cout << num1 << " / " << num2 << " = " << result << endl;
// Oposite Division
result = num2 / num1;
cout << num2 << " / " << num1 << " = " << result << endl;
// Modulation or Reminder
result = num1 % num2;
cout << num1 << " % " << num2 << " = " << result << endl;
// Modulation with another value
num1 = 10;
num2 = 3;
result = num1 % num2;
cout << num1 << " % " << num2 << " = " << result << endl;
result = num1 * 10 + num2;
cout << num1 << " % " << num2 << " = " << result << endl;
cout << 5 / 10 << endl
<< 5.0 / 10.0 << endl;
return 0;
}