Advertisement
borsha06

GCD.cpp

Sep 6th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int recursion(int n1,int n2)
  4. {
  5.     if(n2 == 0)
  6.         return n1;
  7.     return recursion(n2,n1%n2);
  8. }
  9. int main()
  10. {
  11.     int num1,num2,i,j;
  12.     cin>>num1>>num2;
  13.     j= recursion(num1,num2);
  14.     cout<<j<<endl;
  15.  
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement