➽ Program:-

import java.util.*;

import java.io.*;

class Main

{

   public static void main(String args[])

   {

      double principal_amount, rate, time, compound_interest;

      Scanner sc = new Scanner(System.in);

     

      System.out.print("Enter a Principal Amount: ");

      principal_amount = sc.nextDouble();

     

      System.out.print("Enter time(in years): ");

      time = sc.nextDouble();

     

      System.out.print("Enter Rate: ");

      rate = sc.nextDouble();

     

      compound_interest = principal_amount * (Math.pow((1 + rate / 100), time));

     

      System.out.println("Compound Interest = " + compound_interest);

   }

}

➽ Output:-

Enter a Principal Amount: 1700
Enter time(in years): 3
Enter Rate: 6.7
Compound Interest = 2065.1051970999997