Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- long long evclid(int c, int d){
- if (c > d){
- int buf = c-d;
- if (buf == 0){
- return d;
- }
- if (buf != 0){
- return evclid(buf, d);
- }
- }
- if (d > c){
- int buf = d-c;
- if (buf == 0){
- return c;
- }
- if (buf != 0){
- return evclid(c, buf);
- }
- }
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- int a, b, f;
- cin >> a >> b;
- f = evclid(a, b);
- cout << f << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement