hi
I need help with this problem. I have tried writting the program, i just can not get it to run properly.
Please Write
The Fibonacci series
0, 1, 1, 2, 3, 5, 8, 13, 21, ...
begins with the terms 0 and 1 and has the property that each succeeding term is the sum of the two preceding terms.
(a) Write a nonrecursive function fibonacci( n ) that calculates the nth Fibonacci number.
and than you
Aug 2 '06
22 123007 D_C 293
Contributor
The way integers are ordered, are nonnegative numbers, in order, followed by the reversed negative range. It goes from 0 to INT_MAX, then INT_MIN to 1. Integers are 32bit, so in Hexadecimal:
0x00000000 = 0
0x7FFFFFF = INT_MAX = 1+(2^31)
0x80000000 = INT_MIN = (2^31)
0xFFFFFFF = 1.
INT_MAX + 1 = INT_MIN. Since Fibonacci numbers are positive, it will overflow and become negative. Modify the for statement to a while statement, and run the loop while fib is not negative (no overflow). Then variables x1 and x2, x1 < x2, will be the two most positive Fibonacci numbers an integer can support.
Hi,
Please follow the following program,  #include<stdio.h>

#include<conio.h>

void main()

{

int a =0,b=1,c,i=2,n;

clrscr();

printf("Enter N Value : ");

scanf("%d",&n);

printf("%d\t%d\t",a,b);

while(n>i)

{

c = a+b;

printf("%d\t",c);

c=b;

b=a;

i++;

}

getch();

}
Take Care,
Bye... Bye...
The easiset non recursive method I see to do this is to use a stack.
stack will always have 2 elements , both will have integers, and of course pointers.
The next element will be figured by adding the 2 integers in the stack. then you will push that on the top of the stack, and pull the header off of the stack.
I hope that made sence.
hi
I need help with this problem. I have tried writting the program, i just can not get it to run properly.
Please Write
The Fibonacci series
0, 1, 1, 2, 3, 5, 8, 13, 21, ...
begins with the terms 0 and 1 and has the property that each succeeding term is the sum of the two preceding terms.
(a) Write a nonrecursive function fibonacci( n ) that calculates the nth Fibonacci number.
and than you
hello friend,
one thing is remember whenever u r doing fib series most important part is fib generate recursion that is chain is occur. so make one function is fib(). around this function write the code just like this as follows
fo=0;
f1=1
fib=fo+f1;
and display the fib.
try your self otherwise i will send u full program for fib.
thank u very much.
D_C 293
Contributor
Instead of a stack with two entries, just use two variables. Besides, there are already plenty of solutions posted here, and the iterative loop is considerably faster than using recursion.
Banfa 9,065
Recognized Expert Moderator Expert
i want it in c++ not c
And what do you think the difference should be?
Do you want to get hints and try yourself?
or do you want to get a readymade code,just as you buy things from shops?
i want it in c++ not c
 // Recursive method ...Try it.


#include <iostream.h>


static int fibVal = 0;

static int f0 = 0, f1 = 1;


int fib(int n)

{

if(n>0)

{

fibVal = f0 + f1;

f0 = f1;

f1 = fibVal;

cout<<f1<<endl;

n;

fib(n);

}

return f1;

}




void main()

{

int limit;

cout<<"Please Enter the value = ";

cin>>limit;

int answer = 0;


if(limit == 1)

{

cout<<f0<<endl;

}

else if(limit > 1)

{

cout<<f0<<endl;

cout<<f1<<endl;

answer = fib(limit  2);

}

else if(limit <= 0)

cout<<"Please enter the value greater than 0"<<endl;


}
hi
I need help with this problem. I have tried writting the program, i just can not get it to run properly.
Please Write
The Fibonacci series
0, 1, 1, 2, 3, 5, 8, 13, 21, ...
begins with the terms 0 and 1 and has the property that each succeeding term is the sum of the two preceding terms.
(a) Write a nonrecursive function fibonacci( n ) that calculates the nth Fibonacci number.
and than you
plese give me the program.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics 
by: YS Sze 
last post by:
If you know the exact longitude and latitude for a specific
location, would anyone think it'd make any sense to find out if this
set of location numbers is really part of the Fibonacci series or not?
Or, another way to look at this is that: Would anyone of you think it
is worth a while to find out if there is any location on earth with
the set of longitude and latitude numbers that coincides with the
Fibonacci series?
As I see it, if...

by: CII 
last post by:
Hi everybody. I've been reading posts a year old about the fibonacci
series right on this newsgroup, and while it's not directly games
related, I'll share my own notes as well.
On another newsgroup there is an ongoing discussion about the famous
fibonacci sequences, and a fine program written by a poster got my
attention so just for fun I wrote one myself and put it on the web just
about two days ago. It can be found on the site
...

by: student 
last post by:
Hi guys,
please tell me how to write the iterative version of fibonacci series using a stack.
Thanks

by: srinpraveen 
last post by:
I know to write a program to print the fibonacci series. But the problem is my teacher has asked us to write a program to print the natural numbers that are not involved in the fibonacci series.
For example if the user gives 7 terms of the series to be displayed,
then the display of the fibonacci series is 0, 1,1, 2, 3, 5, 8.
But the natural numbers not involved are 4, 6 and 7. That's what my teacher wants.
But I am struggling to write a...

by: guneet bhatia 
last post by:
please help with fibonacci series using recursion..
 
by: rajeshsuri 
last post by:
hi this is rajesh please send program for fibonacci series using pointers or functions

by: omran11 
last post by:
how to generate fibonacci series (lesser than 100)

by: marktang 
last post by:
ONU (Optical Network Unit) is one of the key components for providing highspeed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...

by: Hystou 
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...

by: Hystou 
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...

by: isladogs 
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
 
by: TSSRALBI 
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LANtoLAN VPNs.
The last exercise I practiced was to create a LANtoLAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

by: adsilva 
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

by: 6302768590 
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

by: muto222 
last post by:
How can i add a mobile payment intergratation into php mysql website.

by: bsmnconsultancy 
last post by:
In today's digital era, a welldesigned website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
 