-
Notifications
You must be signed in to change notification settings - Fork 0
/
5-numbers.cpp
27 lines (20 loc) · 1.44 KB
/
5-numbers.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
// Oerations with numbers
#include <iostream>
using namespace std;
int main() {
cout << 7+5 << endl; // Addition
cout << 7-5 << endl; // Subtraction
cout << 7*5 << endl; // Multiplication
cout << 10/5 << endl; // Division
cout << 10%3 << endl; // Remainder
int num1 = 5; // Add (subtract, multiply by, divide by) 1 to a number
num1++;
cout << num1 << endl;
int num2 = 5; // Add (subtract, multiply by, divide by) number to number
num2 += 2;
cout << num2 << endl;
cout << 10/3 << endl; // int op int returns int
cout << 10.0/3.0 << endl; // double op double returns double
cout << 10.0/3 << endl; // double op int returns double
return 0;
}