From aad4ba437968336eace139db4be7b2b2633e5217 Mon Sep 17 00:00:00 2001 From: yamini236 <74612040+yamini236@users.noreply.github.com> Date: Sat, 2 Oct 2021 11:01:17 +0530 Subject: [PATCH 1/3] lcmreturnrecursion --- .../C++_Programs/lcmreturnrecursion.cpp | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Program's_Contributed_By_Contributors/C++_Programs/lcmreturnrecursion.cpp diff --git a/Program's_Contributed_By_Contributors/C++_Programs/lcmreturnrecursion.cpp b/Program's_Contributed_By_Contributors/C++_Programs/lcmreturnrecursion.cpp new file mode 100644 index 0000000000..517b36fde9 --- /dev/null +++ b/Program's_Contributed_By_Contributors/C++_Programs/lcmreturnrecursion.cpp @@ -0,0 +1,41 @@ +#include +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< Date: Sat, 2 Oct 2021 11:14:04 +0530 Subject: [PATCH 2/3] factorialrecursion --- .../C++_Programs/factoralrecursion.cpp | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Program's_Contributed_By_Contributors/C++_Programs/factoralrecursion.cpp diff --git a/Program's_Contributed_By_Contributors/C++_Programs/factoralrecursion.cpp b/Program's_Contributed_By_Contributors/C++_Programs/factoralrecursion.cpp new file mode 100644 index 0000000000..0aa7d08bac --- /dev/null +++ b/Program's_Contributed_By_Contributors/C++_Programs/factoralrecursion.cpp @@ -0,0 +1,26 @@ +#include +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< Date: Sat, 2 Oct 2021 13:29:45 +0530 Subject: [PATCH 3/3] added name in contributor file --- Contributors.html | 1 + 1 file changed, 1 insertion(+) diff --git a/Contributors.html b/Contributors.html index 0837511aa9..8fe933f79a 100644 --- a/Contributors.html +++ b/Contributors.html @@ -259,6 +259,7 @@

Contributors

Ansh Narula Akshat Katiyar Vivek Bhand + Yamini Bansal