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) 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