Posts

Showing posts from November, 2021

C# - Calculate EMI

C# - Calculate EMI CODE using System ; class Program { static void Main () { // Princile Amount double p = 20000 ; // Number of Months double n = 24 ; // Rate of Interest per annum; Example: 7% double r = 10 ; //Calculate rate per month double rm = r / 12 / 100 ; // EMI can be calculated using the formula below. // [P x R x (1+R)^N]/[(1+R)^N - 1)] double monthlyPayment = ( p * rm * Math . Pow (( 1 + rm ), n )) / ( Math . Pow (( 1 + rm ), n ) - 1 ); double yearlyPayment = monthlyPayment * n ; Console . WriteLine ( "Monthly Payment: {0:0.00}" , monthlyPayment ); Console . WriteLine ( "Yearly Payment: {0:0.00}" , yearlyPayment ); Console . WriteLine ( "{0, -10} {1, 10} {2, 20} {3, 20}" , "Month" , "Interest" , "Principle" , ...