.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Code Snippets >> Validations >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Interest calculator in C#

Posted By:Athira Sreejith       Posted Date: December 31, 2008    Points: 10    Category: Validations    URL: http://www.dotnetspark.com  

This code shows how to calculate interest using formula
a=p(1+r)power n

p is the original amount inversted (i.e principal)
r is the annual interest rate
n is the number of years
a is the amount on deposit at the end of the nth year

using System;
public class InterestAmount
public static void Main(string[] args)
decimal Amount=0;
decimal value = 1000;
double IntRate = 0.05;
fir(int iYear=1; iYear <=10; iYear++)
Amount = value * ((decimal) Math>Pow(1.0 + IntRate,iYear));
Response.Write (iYear + "Amount:" + Amount);

} } }


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend