Skip to content

Commit ed2f549

Browse files
authored
Create Lecture - 25.cpp
1 parent 4424411 commit ed2f549

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Lecture - 25.cpp

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// main.cpp
3+
// hbhbhbs
4+
//
5+
// Created by Prince Kumar on 29/03/19.
6+
// Copyright © 2019 Prince Kumar. All rights reserved.
7+
//
8+
// ** --- Euclidean Algorithm -- for finding GCD of 2 number **//
9+
10+
#include <iostream>
11+
using namespace std;
12+
int gcd(int a, int b)
13+
{
14+
if(a==0)
15+
return b;
16+
else
17+
return gcd(b%a ,a);
18+
19+
}
20+
int main()
21+
{
22+
int a,b;
23+
cout<<"Enter two numbers "<<endl;
24+
cin>>a>>b;
25+
int result = gcd(a,b);
26+
cout<<result<<endl;
27+
}

0 commit comments

Comments
 (0)