Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Q9-Write a program to find the compound interest for given principal amount P, time Tm(in years), and interest rate R.
- Ans-import java.io.*; // for handling input/output
- import java.util.*; // contains Collections framework
- // don't change the name of this class
- // you can add inner classes if needed
- class Main {
- public static void main (String[] args) {
- // Your code
- Scanner sc=new Scanner(System.in);
- int P=sc.nextInt();
- int R=sc.nextInt();
- int Tm=sc.nextInt();
- double A=(P*(Math.pow((1+R/100.0),Tm)));
- double CI;
- CI=A-P;
- String ans=String.format("%.2f",CI);
- System.out.print(ans);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement