Code
#include
int main()
{
unsigned int i = 0, j = 0, sum = 1, num;
printf("nEnter the limit for the series ");
scanf("%d", &num);
while (sum < num) {
i = j;
j = sum;
sum = i + j;
}
getch();
}

5 Users have rated as useful.
Login to rate this answer.
Code
#include
using namespace std;
void main()
{
int limit, sum = 0, i = 1, j;
cout << "please enter the limit of the series ";
cin >> limit;
while (sum <= limit) {
j = sum;
sum += i;
i = j;
}
}

1 User has rated as useful.
Login to rate this answer.
Code
#include<stdio.h>
#include<conio.h>
{
int m=0,1,size,sum,k;
printf("ENTER THE SIZE OF THE series"

1 User has rated as useful.
Login to rate this answer.
Code
#include
#include
void main()
{
int a, b, c;
clrscr();
c = a + b;
a = b;
b = c;
getch();
}
Login to rate this answer.
Code
#include
#include
void main()
{
int number;
clrscr();
printf("Enter number till which fibonacci series");
scanf("%d", &number);
for (int first = 0, second = 1, temp; number >= second; temp = second, second = first + second, first = temp)
getch();
}
Login to rate this answer.
Code
#include
main()
{
int a, b, c, n;
a = 0;
b = 0;
c = 1;
printf("enter the value of n");
scanf("%d", &n);
while (n > 0) {
printf("the fibanocci series is%d", c
);
a = b;
b = c;
c = a + b;
n--;
}
}
Login to rate this answer.
Code
int main()
{
int n, i, f1 = 0, f2 = 1, f3 = 0;
printf("Enter number of terms : ");
scanf("%d", &n);
if (n == 1)
if (n == 2)
if (n >= 3) {
for (i = 3; i <= n; i++) {
f3 = f1 + f2;
f1 = f2;
f2 = f3;
}
}
return 0;
}
Login to rate this answer.
Code
#include<stdio.h>
#include<conio.h>
void main()
{
int i,g,h,f;
clrscr();
printf("nEnter the two values from which series should be started");
scanf("%d%d",&g,&h);
printf("nnEnter the value upto which fibonacci series should be generated");
scanf("%d",&f);
i=g+h;
while(i<=f)
{
g=h;
h=i;
i=g+h;
}
getch();
}
Login to rate this answer.
Code
#include<stdio.h>
#include<conio.h>
int main()
{
int num,first=0,second=0,third,i;
clrscr();
for(i=0;i<=num;i++)
{
third=first+second;
first=second;
}
printf("%d %d %d",first
,second
,third
);
getch();
return 0;
}
Login to rate this answer.
Code
#include<stdio.h>
#include<conio.h>
void main()
{
int a = 1 ,b=1,i;
clrscr();
for(i =0;i<=10;i++)
{
a=a+b;
b=a-b;
}
}
Login to rate this answer.
//fibonacci series by number of terms
Code
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0,j=1,k,sum,term;
clrscr();
printf("enter the no of terms:");
scanf("%d",&term);
sum=i+j;
for(k=1;k<=term-3;k++)
{
i=j;
j=sum;
sum=i+j;
}
getch();
}
Login to rate this answer.
Code
declare p number:= 0;
k number: = 0;
d number:= 1;
c number;
begin for i
in 0. .100 loop c:= p + k;
dbms_output.put_line(c);
k:= p + d;
p:= c;
d:= 0;
end loop;
end;
Login to rate this answer.
Code
#include
#include
void main()
{
int n,b,a,t,i;
b=0;
clrscr();
scanf("&d",n);
t=n;
while(n>0)
{
a=n%10;
b=b+a*a*a;
n=n/10;
}
if(t==b)
{
}
else
{
printf("%d not Armstrongn",t
);
}
getch();
}
Login to rate this answer.
Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace fibonacci {
class Program {
static private int MaxVal = 5;
static private int sum = 0;
static private int counter = 0;
static private int fib(int n, int n2) {
Trace.WriteLine(string.Format("n={0} n2={1}", n, n2));
if (counter > MaxVal)
Console.Read();
counter++;
return fib(n2, (n + n2));
} static void Main(string[]args)
{
int i = fib(i, i + 1);
}
}
}
Login to rate this answer.
Code
main()
{
int n i,a=0.b=1,c;
printf("enter d limit of series"):
scanf("%d",&n);
for(i=0;i<=n-2;i++)
{
c=a+b;
a=b;
b=c;
}
getch();
}
Login to rate this answer.
Code
#include<stdio.h>
main()
{
int n=8, i=-1, j=1;
while ( n
-- > 0 && printf ( "%d t ", j
= ( i
= i
) + ( i
= j
) ) );
}
Login to rate this answer.
Code
program fibonacci(input,output);
var :i,x,m,n:integer;
begin
writeln('enter the limit of series');
readln(x);
m:=1;
n:=0;
writeln(n);
writeln(m);
i:=0;
while i<x-2 do
begin
i:i+1;
m:m+n;
n:m-n;
writeln(n);
if i=x-2 then
writeln('finished');
end;
readln;end.
Login to rate this answer.
Code
#include<stdio.h>
#include<conio.h>
main()
{
int i, first, next, lim;
printf("Enter The Limit of Fibonacci Seriese: ");
scanf("%d", &lim);
first = 0;
next = 1;
for (i = 1; i <= lim; i++) {
first = first + next;
next = first - next;
}
getch();
return (0);
}
Login to rate this answer.
sathya
Answered On : Aug 8th, 2011
Code
#include<stdio.h>
#include<conio.h>
main()
{
int n,i,c,a=0,b=1;
printf("Enter fibonacci series of nth term : ");
scanf("%d",&n);
for(i=0;i<=(n-3);i++)
{
c=a+b;
a=b;
b=c;
}
getch();
}
Read more: http://wiki.answers.com/Q/Write_a_program_to_generate_the_Fibonacci_Series#ixzz1URUX5Jiu
Login to rate this answer.
MANUKUNDLOO
Answered On : Sep 8th, 2011
Code
int main()
{
int i=-1,j=1,sum=0,num;
printf("ENTER THE LIMIT OF THE SERIES: ");
scanf("%d",&num);
while(sum<num)
{
sum=i+j;
i=j;
j=sum;
}
getch();
}
Login to rate this answer.
mahamad
Answered On : Apr 19th, 2012
Code
#include<stdio.h>
#include<conio.h>
main()
{
int i,a=0,b=1;
while(i<=9)
{
a=a+b;
b=b+a;
i++;
}
getch();
return 0;
}
Login to rate this answer.
Using the computation by rounding method (see http://en.wikipedia.org/wiki/Fibonacci_number#Computation_by_rounding):
Code
#include <stdio.h>
#include <math.h>
double fib_closed(unsigned long n)
{
double rt5 = sqrt(5.0);
double phi = (1.0 + rt5)/2.0;
return (floor(pow(phi,n)/rt5 + 0.5));
}
int main(void)
{
unsigned long i;
for (i = 0; i < 100; i++)
{
printf("fib_closed(%lu) = %.0f
", i, fib_closed(i));
}
return 0;
}
Login to rate this answer.
madhusudan dadhich
Answered On : Jul 24th, 2012
limit:5
01123
Login to rate this answer.
n.m.sudesh kumar
Answered On : Mar 20th, 2013
Code
#include<stdio.h>
#include<conio.h>
void main()
{
int pre=0,next=1,sum=0,n;
clrscr();
printf("enter the value of n:");
scanf("%d",&n);
while(pre<=n)
{
printf("the fibonacci series; %d
",pre);
sum=pre+next;
pre=next;
next=sum;
}
getch();
}
Login to rate this answer.