Compound interest: We use Math.pow() to compute compound interest, which is an exponential function.
Java that uses Math.pow method
public class Program {
public static void main(String[] args) {
// Raise 5 to the power of 2.
// ... Then raise 3 to the power of 2.
double result1 = Math.pow(5, 2);
double result2 = Math.pow(3, 2);
// ... Display our results.
System.out.println(result1);
System.out.println(result2);
}
}
Output
25.0
9.0
No Comment to " Compound Interest Using Java Program "