To Calculate Compound Interest in Java

Kajjayam Priya Jul 16, 2021

This program finds the compound interest for the given inputs. This source code is written in Java.

To Calculate Compound Interest

This source code takes the inputs of principle, rate of interest and time. By entering the basic formulas we get the requires amount and compound interest by calculation.

 

Implemenation of the source code

import java.util.Scanner;
public class Main
{
public static void main(String args[])
{
double A=0,Pri,Rate,Time,t=1,CI;
Scanner S=new Scanner (System.in);
System.out.print("Enter Principal : " );
Pri=S.nextFloat();
System.out.print("Enter Rate : " );
Rate=S.nextFloat();
System.out.print("Enter Time : " );
Time=S.nextFloat();
Rate(1 + Rate/100);
for(int i=0;i<Time;i++)
t*=Rate;
A=Pri*t;
System.out.print("Amount : " +A);
CI=A-Pri;
System.out.print("\nCompound Interest : " + CI);

 

 

OUTPUT:

Project Files

Loading...
..
This directory is empty.

Comments (0)

Leave a Comment