- Related Questions & Answers
- Calculate compound interest in JavaScript
- C Program for compound interest?
- Python Program for compound interest
- Program to find compound interest in C++
- C Program for the compound interest?
- Compare simple interest and compound interest.
- C++ program to find the rate percentage from compound interest of consecutive years
- Calculate interest amount by using formula in C language
- Java program to calculate mode in Java
- Java program to calculate student grades
- Java program to calculate the percentage
- C Program for simple interest?
- Python Program for simple interest
- Simple interest in Python Program
- Compound assignment operators in Java

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Following is the program to calculate Compound Interest in Java −

import java.io.*; public class Demo{ public static void main(String args[]){ double princ = 456000, rt = 9.75, tm = 7; double comp_int = princ *(Math.pow((1 + rt / 100), tm)); System.out.println("The compound interest for the given principle amount, rate and time is "+ comp_int); } }

The compound interest for the given principle amount, rate and time is 874573.9655622267

A class named Demo contains the main function wherein a principal value, a rate and a time are initialized. The formula for compound interest, principal * ((1 + rate/100) power time) is initialized to a value and the output is calculated. This is displayed on the console.

Advertisements