Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4. long long evclid(int c, int d){
  5.     if (c > d){
  6.         int buf = c-d;
  7.         if (buf == 0){
  8.             return d;
  9.         }
  10.         if (buf != 0){
  11.             return evclid(buf, d);
  12.         }
  13.     }
  14.     if (d > c){
  15.         int buf = d-c;
  16.         if (buf == 0){
  17.             return c;
  18.         }
  19.         if (buf != 0){
  20.             return evclid(c, buf);
  21.         }
  22.     }
  23. }
  24. int _tmain(int argc, _TCHAR* argv[])
  25. {
  26.     int a, b, f;
  27.     cin >> a >> b;
  28.     f = evclid(a, b);
  29.     cout << f << endl;
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement