From c53f9d6e4de5c5c82e9216670c18ddfb4837293d Mon Sep 17 00:00:00 2001 From: SHUBHAM SHARMA <54950485+ShubhamSharma1560@users.noreply.github.com> Date: Wed, 30 Sep 2020 23:24:03 +0530 Subject: [PATCH 1/2] added fibonacci series program --- codes/fibonacci_series.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 codes/fibonacci_series.c diff --git a/codes/fibonacci_series.c b/codes/fibonacci_series.c new file mode 100644 index 0000000..51b52d2 --- /dev/null +++ b/codes/fibonacci_series.c @@ -0,0 +1,18 @@ +//The Fibonacci sequence is a sequence where the next term is the sum of the previous two terms. +//The first two terms of the Fibonacci sequence are 0 followed by 1. + +#include +int main() { + int i, n, t1 = 0, t2 = 1, nextTerm; + printf("Enter the number of terms: "); + scanf("%d", &n); + printf("Fibonacci Series: "); + + for (i = 1; i <= n; ++i) { + printf("%d, ", t1); + nextTerm = t1 + t2; + t1 = t2; + t2 = nextTerm; + } + return 0; +} \ No newline at end of file From 19f8535ab066162953c7e8d50ef27430085e4d12 Mon Sep 17 00:00:00 2001 From: SHUBHAM SHARMA <54950485+ShubhamSharma1560@users.noreply.github.com> Date: Wed, 30 Sep 2020 23:28:51 +0530 Subject: [PATCH 2/2] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9b1a62a..3ccf305 100644 --- a/README.md +++ b/README.md @@ -34,5 +34,6 @@ # [27) Program for checking given year is LEAP or NOT using if / else statement.](codes/leap_year_iff.c) # [28) Program for finding greatest among 3 number using if / else statement.](codes/greatest_iff.c) # [29) Program for reverse the given 3 digit number without loop.](codes/reverse.c) -# [30) Program for Checking the number whether the number is PALINDROM or NOT.](codes/palindrom.c) -# [31) Program for checking the number for armsstrong number of 3 digit without loop.](codes/armstrong_3digit.c) +# [30) Program for Checking the number whether the number is PALINDROME or NOT.](codes/palindrom.c) +# [31) Program for checking the number for Armsstrong number of 3 digit without loop.](codes/armstrong_3digit.c) +# [32) Program for printing Fibonacci Series upto given no. of digit using For loop .](codes/fibonacci_series.c)