## Write a C C++ program to generate Fibonacci series

C के विभिन्न control statements को जानने के लिए देखें— Control statements in C

If statement और decision making statements के बारे में अधिक जानने के लिए देखें— If statements in C

Looping और iterative statements के बारे में और अधिक जानने के लिए देखें— Looping statements in C

### Flowchart to generate Fibonacci series

### C program to generate Fibonacci series

```
#include<stdio.h>
int main()
{
int a=0,b=1,c=1,n;
printf("Enter n: ");
scanf("%d",&n);
printf("%d\n",a);
printf("%d\n",b);
while(c<=n)
{
printf("%d\n",c);
a=b;
b=c;
c=a+b;
}
return 0;
}
```

### C++ program to generate Fibonacci series

```
#include<iostream>
using namespace std;
int main()
{
int a=0,b=1,c=1,n;
cout<<"Enter n: ";
cin>>n;
cout<<a<<"\n";
cout<<b<<"\n";
while(c<=n)
{
cout<<c<<"\n";
a=b;
b=c;
c=a+b;
}
return 0;
}
```

### Output of C C++ program to generate Fibonacci series

Enter n: 10 0 1 1 2 3 5 8

Enter n: 30 0 1 1 2 3 5 8 13 21

### Repetition logic based programs in C C++

- Generate series of natural numbers (while, for, do while)
- Generate series of natural numbers and their sum
- Generate series of odd numbers and find their sum
- Generate series of even numbers and find their sum
- Generate table of given number
- Find factorial of given number
- Find power of given number
- Generate multiplication table of given number
- HCF and LCM of two numbers
- Checking prime number
- Generating series of prime numbers
- Sum of digits of given number
- Reverse of digits of given number
- Checking palindrome number
- Checking Armstrong number
- Generating series of Armstrong numbers
- Convert decimal to binary
- Convert binary to decimal