Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- void fast_evklid (int a, int b)
- {
- int nod;
- if ( a != 0 && b != 0)
- {
- if (a > b)
- {
- a %= b;
- return fast_evklid( a, b);
- }
- else
- {
- b%=a;
- return fast_evklid( a, b);
- }
- }
- else nod = a+b;
- cout << nod;
- }
- int main()
- {
- int a, b;
- cin >> a >> b;
- fast_evklid (a, b);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement