Fibonacci Series

The logic for Fibonacci series very simple. It starts with 0 and 1. The next subsequent term is the sum of the previous two terms.

Source Code

// Program for Fibonacci Number

#include <stdio.h>

void main()
{
int f1 = 0, f2 = 1, f3, n;
printf("Program for Fibonacci Series\n");
printf("Enter the maximum number for Fibonacci Series: ");
scanf("%d", &n);
printf("\nPrinting Fibonacci Series from 0 - %d\n", n);
printf("%d\n%d\n", f1, f2);
while(1)
{
f3 = f1 + f2;
if(f3 > n)
break;
printf("%d\n", f3);
f1 = f2;
f2 = f3;
}
}

Output

Program for Fibonacci Series
Enter the maximum number for Fibonacci Series:
Printing Fibonacci Series from 0 - 1000
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987

16 comments:

1. #include
#include
main()
{
int a=0, b=1,no,counter,c;
printf("\nENTER LENGTH OF SERIES (N) : ");
scanf("%d",&no);
printf("\nFIBONACCI SERIES");
printf("\n\t%d %d",a,b);
for(counter = 1; counter <= no-2; counter++)
{
c=a + b;
printf(" %d",c);
a=b;
b=c;
}
printf("\n");
return 0;
}

1. What is this Md.Faizul Haque Nayan ? Did you read the problem description ?
I think their is an inappropriateness between your code and the given description.
Please check the output of your code.

Best of Luck.....

2. #include
#include

main()
{
long long num1=0, num2=1, temp1=0, input;

printf("Enter the bound : ");
scanf("%lld", &input);

printf("The Fibonacci series from %lld to %lld is :\n%8lld\n%8lld\n", num1, input, num1, num2);
for(;;)
{
temp1 = num1 + num2;

num1 = num2;
num2 = temp1;
if(temp1 >= input)
break;

printf("%8lld\n", temp1);
}

getch();
return 0;
}

3. This comment has been removed by the author.

4. // write a program in fibonacci series by given numbers //

#include
int main()
{
int i,fibo[1000];
fibo[0]=0;
fibo[1]=1;
for(i=2; i<1000; i++){
fibo[i]= fibo[i-1] + fibo[i-2];
}
printf("1st 1000 fibonacci numbers:\n\n");
for(i=0; i<1000; i++){
printf("%d\n",fibo[i]);
}
return 0;
}

5. #include
main()
{
int m=0,n=1,sum=0,i;
printf("fibonacci serise :\n");
printf(" %d \n %d",m,n);
for(i=0;i<=14;i++)
{
sum=m+n;
printf(" \n %d\n",sum);
m=n;
n=sum;
}
}

6. #include

void main()
{
int a1 = 0, fa2 = 1, a3, n;
printf("Program for Fibonacci Series\n");
printf("Enter the maximum number for Fibonacci Series: ");
scanf("%d", &n);
printf("\nPrinting Fibonacci Series from 0 - %d\n", n);
printf("%d\n%d\n", a1, a2);
while(1)
{
a3 = a1 + a2;
if(a3 > n)
break;
printf("%d\n", a3);
a1 = a2;
a2 = a3;
}
}

7. ID #201611036
Link--> https://drive.google.com/open?id=1JLVkEohjm1ICbzXhYMpd2SOe89z4Cjia

8. https://drive.google.com/open?id=18tABnW_ua_RIHDVBcDy3MFAZXXQsvjF1

9. https://drive.google.com/open?id=18tABnW_ua_RIHDVBcDy3MFAZXXQsvjF1

10. ID 201810009
https://drive.google.com/open?id=1WG7pM33N8uRLMuCDZ1Ha92IdKzh0hia3

11. https://drive.google.com/open?id=1LIMe0pvOHHa8nDCmQshzCPkvBfNLs4B3

12. 201810233

https://drive.google.com/file/d/1F04OK5wylCG6Gerlr4FyNubEbXepEqzj/view?usp=drivesdk

13. sijar khan
id:201630992
base:53

#include
using namespace std;

class number
{
private:
int first=0,second=1,digit=0,fibo,n;

public:

number(int x)
{
fibo = x;

}

void display(int n)
{
while(digit>a;

number obj(a);
obj.display( a);

}

14. -------------
ID #201610288
-------------
-------------
Source code:
-------------

#include

using namespace std;
int main(){

int x, y=0, z=1, n;

cout << "Input Fibonacci Limit : ";
cin >> n;

while(y<n){
x = y;
y = z;
z = x + y;
cout << " "<< x << endl;

}
}

15. Nmae : Sumsunnahar Nawa
ID : 201710090
Batch:54th
https://drive.google.com/open?id=1n53NqYgZrBXPyJNhpA66EqGuOtexWQis