Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int counter = 0;
- int gcd(int a, int b)
- {
- if (a == 0)
- return b;
- counter++;
- return gcd(b % a, a);
- }
- int main() {
- int numberOne, numberTwo;
- cout << "Vuvedi dvete chisla" << endl;
- cin >> numberOne >> numberTwo;
- int rezgcd = gcd(numberOne, numberTwo);
- cout << "gcd = " << rezgcd << " stupki: " << counter << endl;
- counter = 0;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement