Write a program in java to find the compound interest when principal,amount,rate of onterestand time is given. Without using Math.pow command.
Answers
Answer:
Java Program to Calculate Compound Interest
In this tutorial, we will write a java program to calculate compound interest.
Compound Interest Formula
Compound interest is calculated using the following formula:
P (1 + R/n) (nt) - P
Here P is principal amount.
R is the annual interest rate.
t is the time the money is invested or borrowed for.
n is the number of times that interest is compounded per unit t, for example if interest is compounded monthly and t is in years then the value of n would be 12. If interest is compounded quarterly and t is in years then the value of n would be 4.
Before writing the java program let’s take an example to calculate the compound interest.
Let’s say an amount of $2,000 is deposited into a bank account as a fixed deposit at an annual interest rate of 8%, compounded monthly, the compound interest after 5 years would be:
P = 2000.
R = 8/100 = 0.08 (decimal).
n = 12.
t = 5.
Let’s put these values in the formula.
Compound Interest = 2000 (1 + 0.08 / 12) (12 * 5) – 2000 = $979.69
So, the compound interest after 5 years is $979.69.
Java Program to calculate Compound Interest
In this java program we are calculating the compound interest, we are taking the same example that we have seen above for the calculation
Please mark my answer as brainliest answer