You need to keep generating Fibonacci numbers until you meet the condition.Check for even valued term by using TERM%2==0 and sum up.Fibonacci series grows exponentially so n wont be very high.Take care that it doesn't overflow integer range.
On Mon, Dec 20, 2010 at 8:36 PM, Shalini Sah < [email protected]> wrote: > Each new term in the Fibonacci sequence is generated by adding the previous > two terms. By starting with 1 and 2, the first 10 terms will be: > > 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... > > Find the sum of all the even-valued terms in the sequence which do not > exceed four million. I'm just a beginner..plz help. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Thanks & Regards Nikhil Agarwal Senior Undergraduate Computer Science & Engineering, National Institute Of Technology, Durgapur,India http://tech-nikk.blogspot.com http://beta.freshersworld.com/communities/nitd -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
