From 834cfa29d8dddffb5560990c096919369aa3cf41 Mon Sep 17 00:00:00 2001 From: Yash Raj Mani <72155985+yashrajmani@users.noreply.github.com> Date: Sun, 17 Oct 2021 08:19:04 +0530 Subject: [PATCH] added Fibonacci in c++ pls merge --- fibonacii.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 fibonacii.cpp diff --git a/fibonacii.cpp b/fibonacii.cpp new file mode 100644 index 0000000..3006364 --- /dev/null +++ b/fibonacii.cpp @@ -0,0 +1,20 @@ +#include +using namespace std; +int main() +{ + + int n1 = 0, n2 = 1; + + cout << n1 << endl<< n2 << endl; + int n3; + for (int i = 2; i < 10; i++) + { + n3 = n1 + n2; + cout << n3 << endl; + n1 = n2; + n2 = n3; + + } + + return 0; +} \ No newline at end of file