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
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
Similar questions