** Question:**** **

#### Write a program that takes an integer number from the user and display it’s Fibonacci Sequence like output sample.

note: Fibonacci sequence is a series numbers where previous two numbers sums is next number like 0 1 1 2 3 5 8 13 21 34.

** Output Sample: **

1 2 3 4 5 |
Enter your number: 10 Fibonacci series: 0 1 1 2 3 5 8 13 21 34 Enter your number: 5 Fibonacci series: 0 1 1 2 3 |

** Source Code: **

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#include<stdio.h> int main() { int n, i; long long d1=0, d2=1, nextTerm; printf("Enter your number: "); scanf("%d", &n); printf("Fibonacci series:"); for(i=1; i<=n; ++i) { printf("%lld ", d1); nextTerm = d1+d2; d1 = d2; d2 = nextTerm; } return 0; } |

Fibonacci sequence using Recursion:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#include<stdio.h> int fib(int); int main() { int n, i, j=0; printf("Enter your number: "); scanf("%d", &n); printf("Fibonacci series: "); for(i=1; i<=n; i++) { printf("%d ", fib(j)); j++; } return 0; } int fib(int y) { if(y==0 || y==1) return y; else return (fib(y-1)+fib(y-2)); } |

** List of C Exercises: **

- Sum of two integer numbers
- Arithmatic calculation
- Average calculation
- Square root of a number
- Celsius to Fahrenheit convert
- Centimter to feet convert
- Square, Cube solution
- Reverse your number
- Find out bigger number
- Find Factorial of a Number
- Integer Number count
- !1+!2+!3+!4+!5…..!n Factorial sum
- Positive or Negative number
- Generate Multiplication Table
- Even or Odd number
- Calculate Power of a Number
- Grading Marks using Switch Case
- Basic Calculator using if-else
- Basic Calculator using Switch Case
- Count your day using switch case
- Leap year counting
- Print Half pyramid using star
- Print half pyramid using numbers
- Print Inverted Half pyramid using star
- Print Inverted Half pyramid using numbers
- Print full pyramid using star
- Print Inverted full pyramid using star
- Print Floyd’s Triangle pyramid
- Print hollow square star pattern
- Print rhombus star pattern
- Print hollow pyramid using star
- Check Vowel or consonant character
- Uppercase and Lowercase English Alphabets prints
- Check Palindrome number
- Fibonacci Sequence display