# Java Program to Calculate Compound Interest

Here you will get java program to calculate compound interest. We can calculate compound interest by following formula. Compound Interest = Principle * (1 + Rate / 100) time Also Read: Java Program to Calculate Simple Interest

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import java.util.Scanner; public class JavaCompoundInterest { public static void main(String args[]){ double p, r, t, ci; Scanner sc = new Scanner(System.in); System.out.print("Enter principle: "); p = sc.nextDouble(); System.out.print("Enter rate: "); r = sc.nextDouble(); System.out.print("Enter time: "); t = sc.nextDouble(); ci = p * (Math.pow(1 + (r / 100), t)); System.out.print("\nCompound Interest = " + ci); } } |

Output Enter principle: 1000 Enter rate: 4 Enter time: 10 Compound Interest = 1480.2442849183444

Read more