By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,057 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

Can anyone help me please ?? URGENT

P: 40

I have two problems and I need your help with the code. below is the question.

1- write a recursive function powe ( base, exponent ) that, when invoked , returns base ^ exponent = base . base ^ exponent - 1

for example , power (3,4) = 3 * 3 * 3 * 3. Assume that exponent is an integer greater than otr equal to 1 . Hint the recursion step would use the relationship

base ^ exponent = base . base ^ exponent-1

and the remaining condition occurs when exponent is equal to 1, because.

base^1 = base.


the second one is :

1- write a nonrecursive function fibonacci ( n ) that calculate the nth fibonacci number.

2- determine the largest int fibonacci number that can be printed on your system. modify the program # 1 to use double instead of int to calculate and return fibonacci numbers, and use this modified program repeat part 2.

thanks in advance.
Sep 23 '06 #1
Share this Question
Share on Google+
1 Reply

P: 293
These are both simple tasks. Have at it, and if you need any help, we'll be more than happy to help.
Sep 23 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.