Skip to content

Commit

Permalink
Merge pull request #329 from yamini236/master
Browse files Browse the repository at this point in the history
lcmreturnrecursion
  • Loading branch information
fineanmol authored Oct 2, 2021
2 parents 6bb4879 + 7ca0018 commit 984216f
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Contributors.html
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,11 @@
<a class="box-item" href="https://github.com/Prakhar-creator"><span>Prakhar Mishra</span></a>
<a class="box-item" href="https://github.com/Whitedevilfury"><span>Kingshuk Roy</span></a>
<a class="box-item" href="https://github.com/Shyam-2001"><span>Shyam Gupta</span></a>
<a class="box-item" href="https://github.com/yamini236"><span>Yamini Bansal</span></a>




<!-- Please maintain the alignment... -->


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include<iostream>
using namespace std;

int factorial(int a){
int b=0,c=0;
if(a>0){
b= factorial(a-1);
b=b*a;
return b;

}
else
{
return 1;
}



}
int main(){
int a,x;
cin>>a;
x=factorial(a);
cout<<x;
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include<iostream>
using namespace std;

int lcm(int a,int b,int i){
int p=0;
if(i<=a || i<=b){
if(a%i==0 && b%i==0){
p=lcm(a/i,b/i,i);
return p*i;

}
else if(a%i==0){
p=lcm(a/i,b,i);
return p*i;


}
else if(b%i==0){
p=lcm(a,b/i,i);
return p*i;


}
else{
p=lcm(a,b,i+1);
return p;

}

}
else{
return 1;
}
}
int main(){
int a,b,x;
cin>>a>>b;
x=lcm(a,b,2);
cout<<x;
return 0;
}

0 comments on commit 984216f

Please sign in to comment.