baseersd Profile Answers by baseersd Jul 27th, 2007 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) { printf("%d ", sum); i = j; j = sum; sum = i + j; } getch(); }
memo132006 Profile Answers by memo132006 Oct 8th, 2008 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) { cout << sum << endl; j = sum; sum += i; i = j; } }
pullaiah06 Profile Answers by pullaiah06 May 1st, 2009 Code #include<stdio.h> #include<conio.h> { int m=0,1,size,sum,k; printf("ENTER THE SIZE OF THE series"
trogen Profile Answers by trogen May 3rd, 2009 Code #include #include void main() { int a, b, c; clrscr(); c = a + b; a = b; b = c; printf("n %d", a); getch(); }
bhaumikshah04 Profile Answers by bhaumikshah04 Jun 19th, 2009 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) printf("n%d", second); getch(); }
vigneshwaransankaran Profile Answers by vigneshwaransankaran Sep 13th, 2009 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--; } }
sarabjit Profile Answers by sarabjit Sep 18th, 2009 Code int main() { int n, i, f1 = 0, f2 = 1, f3 = 0; printf("Enter number of terms : "); scanf("%d", &n); if (n == 1) printf("0"); if (n == 2) printf("0 1"); if (n >= 3) { for (i = 3; i <= n; i++) { f3 = f1 + f2; f1 = f2; f2 = f3; printf("%d", f3); } } return 0; }
shankar555 Profile Answers by shankar555 Dec 25th, 2009 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) { printf("n%d",i); g=h; h=i; i=g+h; } getch(); }
vinay kumar sharma Profile Answers by vinay kumar sharma Feb 5th, 2010 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; }
SagarDamani Profile Answers by SagarDamani Feb 12th, 2010 Code #include<stdio.h> #include<conio.h> void main() { int a = 1 ,b=1,i; clrscr(); printf("%d",a); printf(" %d",b); for(i =0;i<=10;i++) { a=a+b; printf(" %d",a); b=a-b; } }
pravigupta Profile Answers by pravigupta Aug 30th, 2010 //fibonacci series by number of termsCode #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; printf("%d,%d,%d",i,j,sum); for(k=1;k<=term-3;k++) { i=j; j=sum; sum=i+j; printf(",%d",sum); } getch(); }
srikanthsunkari Profile Answers by srikanthsunkari Sep 27th, 2010 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;
mafias18 Profile Answers by mafias18 Oct 10th, 2010 Code #include #include void main() { int n,b,a,t,i; b=0; clrscr(); printf("enter the number"); scanf("&d",n); t=n; while(n>0) { a=n%10; b=b+a*a*a; n=n/10; } if(t==b) { printf("%d Armstrongn",t); } else { printf("%d not Armstrongn",t); } getch(); }
elenanesg Profile Answers by elenanesg Oct 24th, 2010 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); } } }
prititripathi Profile Answers by prititripathi Dec 18th, 2010 Codemain() { int n i,a=0.b=1,c; printf("enter d limit of series"): scanf("%d",&n); printf("%d,%d", a,b); for(i=0;i<=n-2;i++) { c=a+b; a=b; b=c; printf("%d",c); } getch(); }
birlawhite Profile Answers by birlawhite Jan 18th, 2011 Code#include<stdio.h> main() { int n=8, i=-1, j=1; while ( n-- > 0 && printf ( "%d t ", j = ( i = i ) + ( i = j ) ) ); }
RAHAEL Profile Answers by RAHAEL Mar 3rd, 2011 Codeprogram 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.
Shaikh Muqeet Ahmed Profile Answers by Shaikh Muqeet Ahmed Mar 16th, 2011 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++) { printf("%d", first); first = first + next; next = first - next; } getch(); return (0); }
sathya 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); printf("%d %d ",a,b); for(i=0;i<=(n-3);i++) { c=a+b; a=b; b=c; printf("%d ",c); } getch(); }
MANUKUNDLOO Sep 8th, 2011 Codeint 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; printf("%d",sum); } getch(); }
mahamad Apr 19th, 2012 Code#include<stdio.h> #include<conio.h> main() { int i,a=0,b=1; while(i<=9) { printf("%d ",a); printf("%d ",b); a=a+b; b=b+a; i++; } getch(); return 0; }
jbode Profile Answers by jbode Questions by jbode Jun 29th, 2012 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; }
n.m.sudesh kumar 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(); }
keerthi Jun 7th, 2013 Code for fibonacci seriesCode#include<stdio.h> void main(){ int i=0,j=1,sum=0,num; printf("enter the size of the series"); scanf("%d",&num); while(sum<num){ printf("%d",sum); i=j; j=sum; sum=i+j; } getch(); }
Write a program to implement the Fibonacci series
Editorial / Best Answer
baseersdRelated Answered Questions
Related Open Questions