Skip to content

Commit

Permalink
Merge pull request 0xali3n#128 from Manali71/main
Browse files Browse the repository at this point in the history
Added Compound Interest.java
  • Loading branch information
0xali3n authored Oct 21, 2021
2 parents 0ba700f + e455008 commit 3850723
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Java Programs/Compound Interest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import static java.lang.Math.pow;

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

double amount=0,principle,rate,time,ci,t=1;



Scanner sc=new Scanner(System.in);

System.out.println("enter principle ");

principle=sc.nextDouble();

System.out.println("enter rate");

rate=sc.nextDouble();

System.out.println("enter time");

time=sc.nextDouble();

rate=(1+rate/100);

for(int i=0;i<time;i++)
t*=rate;


amount=principle*t;

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

ci=amount-principle;

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

}
}

0 comments on commit 3850723

Please sign in to comment.