Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- НОД алгоритм Евклида с остатком от деления
- int gcd(int a, int b)
- {
- while (b != 0)
- {
- int c = a % b;
- a = b;
- b = c;
- }
- return a;
- }
- int main()
- {
- cout << gcd(624960, 49104);
- //cout << gcd(49104, 624960);
- cout << 5 / 3 << endl; // 1
- cout << 5 / 2.5 << endl; // 2
- cout << 2.5 / 5 << endl; // 0.5
- cout << endl;
- cout << 5 % 3 << endl; // 2
- cout << 5 % 5 << endl; // 0
- cout << 10 % 5 << endl;// 0
- cout << endl;
- cout << 2 % 4 << endl; // 2 !!! ОСОБОЕ ВНИМАНИЕ !!!
- cout << 3 % 9 << endl; // 3 !!! ОСОБОЕ ВНИМАНИЕ !!!
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement