Advertisement
nguyenvanquan7826

UCLN

Feb 25th, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. /*
  2.  * UCLN.cpp
  3.  *
  4.  * Copyright 2014 by nguyenvanquan7826
  5.  *
  6.  * Email : [email protected]
  7.  * Blog : nguyenvanquan7826.wordpress.com
  8.  *
  9.  */
  10.  
  11. #include <iostream>
  12.  
  13. using namespace std;
  14.  
  15. int UCLN(int a, int b){
  16.     if (a%b == 0) return b;
  17.     return (UCLN(b, a%b));
  18. }
  19.  
  20. int main (int argc, char **argv)
  21. {
  22.     int a, b;
  23.     cin >> a >> b;
  24.     cout << UCLN(a, b);
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement