TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jonathan Crispe
NA
46
48.5k
Multiplication using recursion
Nov 23 2011 9:47 PM
i have this value and know how to calculate it but i don't know how to put in a recursion code.
Any advice pls...Thank you
the amount $10000
the interest rate 10%
the investment period 10 years
the total value would $25, 937.42
main calls Ryear(10) return 23579.47
n = 10 return 23579.47 * 1.1
n = 9 return 21435.89 * 1.1
n = 8 return 19487.17 * 1.1
n = 7 return 17715.61 * 1.1
n = 6 return 16105.1 * 1.1
n = 5 return 14641 * 1.1
n = 4 return 13310 * 1.1
n = 3 return 12100 * 1.1
n = 2 return 11000 * 1.1
n = 1 return 10000 * 1.1
n = 0 Return 10000
this just is the example i got from my class...
static void Main(string[] args)
{
Console.WriteLine(Ryear(10));
Console.ReadLine();
}
static private int Ryear(int n)
{
int amount = 10000;
int
if (n < 1)
return 0;
else
return Ryear(n-1)+ n;
}
Reply
Answers (
9
)
Two forms, labels do not update
How to serialize may biometric template?