Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lcmreturnrecursion #329

Merged
merged 5 commits into from
Oct 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}