diff --git a/fixme.cpp b/fixme.cpp index 547f2d9..91247c1 100644 --- a/fixme.cpp +++ b/fixme.cpp @@ -1,30 +1,30 @@ #include - using namespace std; - - // Function to generate Fibonacci series up to n terms - void fibonacci(int n) { - int first = 0, second = 1, next; - - cout << "Fibonacci Series: "; - for (int i = 0; i < n; i++) { - // FIXME: Print the first term correctly - cout << "?" << " "; - - // FIXME: Compute the next term correctly - next = ?; - first = second; - second = next; - } - cout << endl; - } - - int main() { - int n; - cout << "Enter the number of terms: "; - cin >> n; - - // FIXME: Call the function with correct argument - fibonacci(?); - - return 0; - } \ No newline at end of file +using namespace std; + +// Function to generate Fibonacci series up to n terms +void fibonacci(int n) { + int first = 0, second = 1, next; + + cout << "Fibonacci Series: "; + for (int i = 0; i < n; i++) { + // Print the current term + cout << first << " "; + + // Compute the next term correctly + next = first + second; + first = second; + second = next; + } + cout << endl; +} + +int main() { + int n; + cout << "Enter the number of terms: "; + cin >> n; + + // Call the function with the correct argument + fibonacci(n); + + return 0; +} \ No newline at end of file