java Program to calculate compound interest

Introduction

In this demo I have used NetBeans IDE 8.2 for debugging purpose. But you can use any java programming language compiler as per your availability..

class CompundInterest {
        public static void main(String args[]) {

        double amount = 0, principle = 1000, rate = 10, time = 3, ci;

        System.out.println("principle= " + principle);

        System.out.println("rate= " + rate);

        System.out.println("time= " + time);

        amount = principle * ((1 + rate / 100) * (1 + rate / 100) * (1 + rate / 100));

        System.out.println("amount= " + amount);

        ci = amount - principle;

        System.out.println("compound interest = " + ci);

         }
}

Result

java Program to calculate compound interest
java Program to calculate compound interest

Leave a Comment