Created
February 12, 2016 19:04
-
-
Save abdalimran/5d3b2a4fb917e5518131 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Bismillah hir rahmanir raheem. Thanks to Allah for everything. | |
Coder: Abdullah Al Imran | |
Email: [email protected] */ | |
#include<bits/stdc++.h> | |
using namespace std; | |
//Recursively | |
int gcd(int a, int b) | |
{ | |
if(b==0) | |
return a; | |
else | |
return gcd(b, a%b); | |
} | |
//Shortly | |
int gcd(int a, int b) | |
{ | |
return b == 0?a:gcd(b,a%b); | |
} | |
int main() | |
{ | |
ios_base::sync_with_stdio(false); | |
//cout<<gcd(8,10)<<endl; | |
cout<< __gcd(8,12)<<endl; //This function works only in gnu gcc/g++ compilers. | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment