Study guides

☆

Q: Write a program to generate the Fibonacci Series using pointers?

Write your answer...

Submit

Still have questions?

Continue Learning about Engineering

program to Display Fibonacci series (0,1,1,2,3,5,8,13------)

write a program that display the Fibonacci series?

112358

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

Let x = 1, let y = 0.Print x.Let x = y + xLet y = x - yRepeat from 2.Public Sub Main() Dim X As Integer Dim Y As Integer Dim cnt As Integer 'Our counter. cnt = 1 Do While cnt < 8 Debug.Print X X = Y + X Y = X - Y cnt = cnt + 1 Loop End Sub

Related questions

program to Display Fibonacci series (0,1,1,2,3,5,8,13------)

no...i want complete c code using stack

write a program that display the Fibonacci series?

i dn't know. haha

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

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

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").

subtract the smallest one

#include #include void main() { clrscr() int a=0,b=1,c,i,n; coutn cout

Here is a recursive way of writing Fibonacci series f(n) = f(n-1) + f(n-2)

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

Where are the numbers that you want to sum.

People also asked