Computer Science, asked by shalini6, 1 year ago

a man invest sum of money at 5. compound interest for first year ,8.for second year . write a program in java to calculate the amount after three years , takimg sum as input

Answers

Answered by lfstone3
1
By applying the formula for compound interest in our program which is  FV= P(1+ \frac{r}{n} )^{yrs} where FV is future value, P is principal amount, r is annual rate of interest, but since interest is added as per year we will be using just r instead of  \frac{r}{n}
(.03 percent is used because 3% keeps increasing)

Code is over here:

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package myexperiment;

/**
 *
 * @author Lfstone3
 */
import java.util.Scanner;


public class Investment {
    public static void main(String args[]){
    Scanner scn =new Scanner(System.in);
   
    System.out.println("Enter amount of sum of money:- ");
    int cmpdn = scn.nextInt();
    System.out.println("compund interest(FV) in 2 yrs:- " + "Rupees "+ Math.pow(cmpdn*1+.03,2));
   
 }
   
}



Similar questions