Computer Science, asked by Anonymous, 4 months ago

Write a program in java to calculate the amount and compound interest.

Amount= principal*(1+r/100)t

ci = amount - principal​

Answers

Answered by anindyaadhikari13
2

Required Answer:-

Question:

  • Write a Java program to calculate amount and compound interest.

Solution:

Here comes the program.

import java.util.*;

public class Java {

 public static void main(String[] args) {

    Scanner sc=new Scanner(System.in);

    float p, r, t, a, ci;

    System.out.print("Enter Principal: ");

    p=sc.nextFloat();

    System.out.print("Enter Rate: ");

    r=sc.nextFloat();

    System.out.print("Enter Time: ");

    t=sc.nextFloat();

    a=p*(float)Math.pow(1+r/100.0, t);

    System.out.println("Amount: "+a);

    ci=a-p;

    System.out.println("Compound Interest: "+ci);

    sc.close();

 }

}

Algorithm:

  1. START.
  2. Accept principal, rate and time.
  3. Calculate amount and compound interest.
  4. Display the result.
  5. STOP.

See the attachment for output .

Attachments:
Answered by Anonymous
1

Principal Amount Formulas

We can rearrange the interest formula, I = PRT to calculate the principal amount. The new, rearranged formula would be P = I / (RT), which is principal amount equals interest divided by interest rate times the amount of time.

fine an u

how's ur study bestu

Similar questions