Computer Science, asked by Debasish6517, 11 months ago

Java programming a man invested certain sum of money at 5% compound interest for first year ,8% for second year and 10 % for the third year write a program to calculate the amount after after three years taking sum as a input

Answers

Answered by anindyaadhikari13
2

Question:-

A man invested certain sum of money at 5% compound interest for first year ,8% for second year and 10 % for the third year. Write a program to calculate the amount after after three years taking sum as a input.

Program Approach:-

import java.util.*;

class CI

{

public static void main(String args[])

{

double p, a, r1=5, r2=8, r3=10;

Scanner sc = new Scanner(System.in);

System.out.print("Enter the principal amount: ");

p=sc.nextDouble();

a=p*(1+r1/100.0)*(1+r2/100.0)*(1+r3/100.0);

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

}

}

Note:-

Amount for variable rate of interest in calculated by using the formula

  • \sf A=P(1+\frac{r_{1}}{100})(1+\frac{r_{2}}{100})(1+\frac{r_{3}}{100}).....
Similar questions