Skip to content

Commit

Permalink
day 13 implementation (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruv-gupta14 authored and MadhavBahl committed Jan 8, 2019
1 parent b0db576 commit 384418f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
21 changes: 21 additions & 0 deletions day13/C++/day13a.cpp
@@ -0,0 +1,21 @@
/*
* @author : dhruv-gupta14
* @date : 8/01/2019
*/

#include <bits/stdc++.h>
using namespace std;

long long calc_fact(long long n)
{
if (n <= 1)
return 1;
return n*calc_fact(n-1);
}
int main()
{
long long n;
cin>>n;
cout<<calc_fact(n)<<endl;
return 0;
}
21 changes: 21 additions & 0 deletions day13/C++/day13b.cpp
@@ -0,0 +1,21 @@
/*
* @author : dhruv-gupta14
* @date : 8/01/2019
*/

#include <bits/stdc++.h>
using namespace std;

long long fib_num(long long n)
{
if (n <= 2)
return 1;
return fib_num(n-1)+fib_num(n-2);
}
int main()
{
long long n;
cin>>n;
cout<<fib_num(n)<<endl;
return 0;
}

0 comments on commit 384418f

Please sign in to comment.