what is the compound interest formula if i'm using 'i' for the rate and 'n' for the numbers of years ???
i already wrote two functions but they're not working !!!!
//============================================
// First one
//========
public float Total(float i,int n) //Savings -> return balance after n years and i interest
{
for(int count=0; count<n; count++)
{
Balance *= Math.pow(( 1 + i ), n);
}
return Balance;
}
//================
// Second one
//========
public float Total(float i,int n) //Savings -> return balance after n years and i interest
{
return Balance *= Math.pow(( 1 + i ), n);
}
//============================
i don't know what one is the correct one .... i'm not a business major :P
and if by any chance ..... could anyone tell me how to do it in the recursive way !!!
Mayank SAssociate Director - Product EngineeringCommented:
public float Total(float i,int n) //Savings -> return balance after n years and i interest
{
return Balance *= Math.pow(( 1 + i ), n);
}
//============================
Sorry, I thought I saw a call to Total () instead of pow :-) didn't read it completely.... thought that the first was non-recursive and the second recursive.
Anyways, he's still not told us why he needs the recursion.
Mayank SAssociate Director - Product EngineeringCommented:
By the way, why did you accept my comment as an assist? (I was still waiting to assist after getting some comments from you :-) )
0
Featured Post
An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.
One of a set of tools we're offering as a way of saying thank you for being a part of the community.