Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
abdurrezzak authored Oct 22, 2017
1 parent b7e4e75 commit c42ad20
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions 4.EuclidianGCD.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* This program takes two numbers as input and
* calculates their greates common divisor using
* Euclidian Algorithm
* For more information about the Algorithm: https://en.wikipedia.org/index.php?q=aHR0cHM6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvRXVjbGlkZWFuX2FsZ29yaXRobQ
*
* Coded by: Abdurrezak EFE
*
* */
#include <iostream>
#include <algorithm>
using namespace std;

int gcd(int a, int b)
{
if(a%b == 0)
return b;
else
return gcd(b,a%b);
}

int main()
{
int a,b; //taking the inputs
cin >> a >> b;

cout << "GCD of " << a << " and " <<b <<" is: " << gcd(a,b) << endl;

}

0 comments on commit c42ad20

Please sign in to comment.