how to write mathmatical code in c#.Actually i want to calculate the fixed deposite calculation in my project so how could i write the below formulla in c#
A=p(1+r/n)nt,n=4 quaterly,t=no of year
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted May 7, 2013, 4:39 AM
Bhabani prasad DashPosted May 7, 2013, 6:38 AM
VulpesPosted May 7, 2013, 6:30 AM
My scientific calculator gives exactly the same answer:
1000 x 1.045 ^ 40 = 5816.36
So, I'm sure the program is working correctly.
Bhabani prasad DashPosted May 7, 2013, 6:20 AM
{
double p = Double.Parse(txt_installmentamt.Text);
double r =(Double.Parse(lbl_rtofintr.Text)/100);
int n = 4; // quarterly
int t =int.Parse(lbl_tenure.Text);
double A = AccumulatedValue(p, r, n, t);
lbl_depamt.Text = (Double.Parse(txt_installmentamt.Text)).ToString("#0.00");
lbl_returns.Text = A.ToString("#0.00");
}
protected double AccumulatedValue(double p, double r, int n, int t)
{
return p * Math.Pow(1 + r / n, n * t);
}
u give me this code and it only working for one year more than one year it show wrong information
plz help me
VulpesPosted May 7, 2013, 6:14 AM
However, as a general rule, I only answer questions on the forum itself.
Bhabani prasad DashPosted May 7, 2013, 6:05 AM
VulpesPosted May 7, 2013, 5:54 AM
9% = 1259.68
18% = 1321.77
My scientific calculator gives exactly the same results.
The calculator on this site:
http://easycalculation.com/finance/recurring-deposits-maturity-value.php
gives the following answers:
9% = 1257.91
18% = 1321.34
Not quite the same - possibly due to rounding errors.
What do you get?
Bhabani prasad DashPosted May 7, 2013, 5:05 AM
double i = (Double.Parse(lbl_rtofintr.Text)/400);
//int n =int.Parse( lbl_tenure.Text);
int n = 4;
double M = R * (Math.Pow(1 + i, n) - 1) / (1 - Math.Pow(1 + i, -1.0 / 3.0));
lbl_returns.Text = M.ToString("#0.00");
lbl_depamt.Text = (Double.Parse(txt_installmentamt.Text) * Double.Parse(lbl_tenure.Text)).ToString("#0.00");
i have got the correct answer when am calculate intest on 9% but it fails to give correct answer when am using 18%intrest
Bhabani prasad DashPosted May 7, 2013, 4:42 AM
Bhabani prasad DashPosted May 7, 2013, 4:28 AM
//txt_insta=installment amount
double R = Double.Parse(txt_installmentamt.Text);
//lbl_rtofint=rate of intrest
double i = (Double.Parse(lbl_rtofintr.Text)/400);
//lbl_tenure=how much time he wiil givemeans for 12 month or 24 etc
int n =int.Parse( lbl_tenure.Text);
double M = R * (Math.Pow(1 + i, n) - 1) / (1 - Math.Pow(1 + i, -1.0 / 3.0));
lbl_returns.Text = M.ToString("#0.00");
lbl_depamt.Text = (Double.Parse(txt_installmentamt.Text) * Double.Parse(lbl_tenure.Text)).ToString("#0.00");
VulpesPosted May 7, 2013, 4:10 AM
double M = R * (Math.Pow(1 + i, n) - 1)/ (1 - Math.Pow(1 + i, -1.0/3.0));
Bhabani prasad DashPosted May 7, 2013, 3:25 AM
Riddhi ValechaPosted May 7, 2013, 3:17 AM
Did not get - plz tell me the calclation of recurring deposite
Bhabani prasad DashPosted May 7, 2013, 1:20 AM
VulpesPosted May 6, 2013, 8:43 AM
The output should be 1638.62 of whatever currency you're using.