Skip to content

Commit

Permalink
Remove extra whitespace/lines
Browse files Browse the repository at this point in the history
  • Loading branch information
arnavb authored Feb 27, 2019
1 parent 6857951 commit 7e2eafd
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

long long fibonacci (int n) {
static long long fib[100] = {}; // initialises the array with all elements as 0
fib[1] = 0;
fib[1] = 0;
fib[2] = 1;
if (n == 1 || n == 2)

if (n == 1 || n == 2)
return fib[n];
else if (fib[n] != 0)
else if (fib[n] != 0)
return fib[n];
else {
fib[n] = fibonacci (n - 1) + fibonacci (n - 2);
Expand All @@ -17,12 +17,9 @@ long long fibonacci (int n) {
}

int main () {

int n;
std::cout << "Enter number of terms: ";
std::cin >> n;
for (int i = 1; i <= n; i++)
std::cout << fibonacci (i) << std::endl;

return 0;
for (int i = 1; i <= n; i++)
std::cout << fibonacci (i) << std::endl;
}

0 comments on commit 7e2eafd

Please sign in to comment.