From 260ba8d3a46e76b8d319c96b23983c9c2d93d046 Mon Sep 17 00:00:00 2001 From: Krishna Vedala Date: Mon, 25 May 2020 22:13:52 -0400 Subject: [PATCH] syntax correction --- math/fibonacci.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/math/fibonacci.cpp b/math/fibonacci.cpp index 1c07cd93f..e82875da3 100644 --- a/math/fibonacci.cpp +++ b/math/fibonacci.cpp @@ -1,5 +1,5 @@ -#include #include +#include /* Calculate the the value on Fibonacci's sequence given an integer as input @@ -7,14 +7,13 @@ Fibonacci = 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ... */ -int fibonacci(uint n) { +int fibonacci(unsigned int n) { /* If the input is 0 or 1 just return the same This will set the first 2 values of the sequence */ - if (n <= 1) - return n; + if (n <= 1) return n; /* Add the last 2 values of the sequence to get next */ - return fibonacci(n-1) + fibonacci(n-2); + return fibonacci(n - 1) + fibonacci(n - 2); } int main() {