From 7f7fac37037a73054250d19073bd77f3cb19459a Mon Sep 17 00:00:00 2001 From: ashish12011046 <115063458+ashish12011046@users.noreply.github.com> Date: Fri, 7 Oct 2022 19:14:27 +0530 Subject: [PATCH] Create Pattern_Matching_Fibonacci_Series.cpp find first n fibonacci series --- Pattern/Pattern_Matching_Fibonacci_Series.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Pattern/Pattern_Matching_Fibonacci_Series.cpp diff --git a/Pattern/Pattern_Matching_Fibonacci_Series.cpp b/Pattern/Pattern_Matching_Fibonacci_Series.cpp new file mode 100644 index 0000000..f4286a0 --- /dev/null +++ b/Pattern/Pattern_Matching_Fibonacci_Series.cpp @@ -0,0 +1,17 @@ +#include +using namespace std; + +int main (){ + int n; + cout<<"Enter the value of n : "; + cin>>n; + int a= 0; + int b =1; + cout << a<< " " << b << " "; + for (int i=3; i<=n ; i++){ + int next_num = a+b; + cout << next_num << " "; + a=b; + b= next_num; + } +}