Advertisement
nikminer4sv

week_2_3

Feb 4th, 2021
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>                                    
  2. using namespace std;                                    
  3. int gcd(int a, int b) {
  4.         if (b == 0)
  5.                 return a;
  6.         a = a % b;
  7.         return gcd(b,a);
  8. }
  9.  
  10. int main() {
  11.         int a, b;
  12.         cin >> a >> b;
  13.         cout << gcd(a,b) << endl;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement