Study guides

☆☆

Q: Write a program to display the Fibonacci series?

Write your answer...

Submit

Still have questions?

Continue Learning about Engineering

write a c program to display * * * * * * * * * * * * * * * *

m,kj,kh,kj

In a Fibonacci sequence, the previous two numbers are added to generate the next Fibonacci number. F1=1st number F2=2nd number F3=f1+f2=1+2=3 F4=f2+f3=2+3=5 F5=f3+f4=3+5=8, and so on. f1 f2 f3 f4 f5 f6 f7.............. 1 2 3 5 8 13 21............. In algorithm: 1. Assign sum=0, A=0, B=1, i=1 2. Get the no. of terms upto which u want to generate the Fibonacci no, i.e., n. 3.Add A and B to get the next Fibonacci number 4. Assign the value of B to A i.e. A=B 5. Assign the value of sum to B i.e. B=sum 6. Write the value of su to get next Fibonacci number in the series. 7. increment i with 1 i.e. i=i+1 and repeat step 3,4,5,6 with the last value of i=n(n is the no. of terms which u wnt to generate Fibonacci no. series.) 8. Stop

good question! I'll write it in semi-program lingo, so you can translate it to visual basic language yourself later. Fibonacci = 1,1,2,3,5,8,13,21 etc. x = 1 y = 1 print x, print y loop(parameters) //loop this function } z = x+y print z x = y y = z { In this, you start with 1 and 1, then add them together and display that number. Then you set y equal to that number, and x equal to the number behind it. then repeat that. This should give you the Fibonacci sequence. -Jp

It is very easy to write the program for seeing the algorithm. Most of the problems that we are write with seeing the algorithm only. Algorithm is very easy to write the any source code seeing this is very useful to write the program

Related questions

Fibonacci series has absolutely nothing to do with pointers.

write a program for Fibonacci series by using cunstructer ti initilised the value

Exactly what do you mean by 'C program in Java'

Where are the numbers that you want to sum.

Is this a homework question?

write a c program to display * * * * * * * * * * * * * * * *

Just generate the Fibonacci numbers one by one, and print each number's last digit ie number%10.

Set two variables "a" and "b" to the starting number of the Fibonacci series, for example, 1 and 1. Then, repeatedly (i.e., in a loop) set: sum = a + b; b = a; a = sum; ... and print the sum (or equivalently, variable "a").

Faisal

write a program to display your name age class schoolname e-mail 2hobby based on choice

This program prints the Fibonacci series #include<stdio.h> #include<conio.h> void main(void) { int i,j,k,n; clrscr(); i=0; j=1; printf("%d %d ",i,j); for(n=0;n<=5;n++) { k=i+j; i=j; j=k; printf("%d ",k); } getch(); }

I need the program that can display this number 4 12 44 444 5555 66666

People also asked