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, int & s){
- s++;
- if (b==0){
- return a;
- }else{
- return gcd(b, a%b, s);
- }
- }
- int main(){
- int a, b;
- cin>>a>>b;
- int s=0;
- cout<<gcd (a, b, s)<<endl;
- cout<<s<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement