Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- /* operatory arytmetyczne:
- + dodawanie
- - odejmowanie
- * mnozenie
- / dzielenie
- % reszta z dzielenia
- */
- int liczba1 = 100;
- int liczba2 = 15;
- cout << liczba1 + liczba2 << endl; // 115
- cout << liczba1 - liczba2 << endl; // 85
- cout << liczba1 * liczba2 << endl; // 1500
- cout << liczba1 / liczba2 << endl; // 6
- cout << liczba1 % liczba2 << endl; // 10
- cout << 1.0 * liczba1 / liczba2 << endl; // 6.6667
- // UWAGA: dzielenie przez siebie dwóch liczb całkowitych zawsze daje wynik całkowity. Aby tego uniknąć, przynajmniej jedna z liczb biorących udział w dzieleniu musi być liczbą rzeczywistą
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement