Write a program in Java to calculate compound interest
NO SPAMMING
Answers
We take principal (p), time (t), rate of interest (r) and the number of times the interest is compound (n) as inputs. Amount is calculated using the formuale p * ( 1 + r/n )nt. In Java, the Math.pow() function is used to calculate powers. For example, to calculate 32, we use Math.pow(3,2). After finding amount, we find interest by subtracting principal.
Sample Execution :
Input :
p = 3400
t = 3
r = 4
n = 2
Output :
Compond Interest is 2475200.0
Amount is 2478600.0
we take principle (p),time (t),rate of interest(r) and number of times the interest is compound (n) as inputs. amount is calculated using in formule p*(1+r/n)nt. in java the math.pow() function is used to calculate power.For example , to calculate 3^2 we use math. pow (3,2) . after finding amount we find interest by subtracting principle.