0% found this document useful (0 votes)
30 views1 page

Calculating Compound Interest

This Java program calculates compound interest earned on a principal amount over a number of years at a given interest rate. The user provides the principal, annual interest rate, and number of years as command line arguments. The program uses the formula to calculate compound interest by multiplying the principal by (1 + interest rate/100) raised to the power of number of years, and outputs the interest amount.

Uploaded by

feezy1
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views1 page

Calculating Compound Interest

This Java program calculates compound interest earned on a principal amount over a number of years at a given interest rate. The user provides the principal, annual interest rate, and number of years as command line arguments. The program uses the formula to calculate compound interest by multiplying the principal by (1 + interest rate/100) raised to the power of number of years, and outputs the interest amount.

Uploaded by

feezy1
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Program to calculate the compound interest import java.lang.

Math; class cmpint { public static void main(String ar[]) { double a,itr,p,r; int y;

p=Float.valueOf(ar[0]).floatValue(); r=Float.valueOf(ar[1]).floatValue(); y=Integer.parseInt(ar[2]);

a=p*Math.pow((1+(double)1/r),y); itr=a-p;

System.out.println("Compound Interest:"+ itr); } } Output:

W3Professors.Com

Ishmeet Singh Dang

You might also like