A man invests certain sum of money at 5% compound interest for the first year, 8for the second year and 10% for the third vear. Write a program in Java to calcula the amount after three years, taking the sum as an input. (Hint: A = P(1 R1/100)(1 +R2/100)(1 +R3/100)]
Answers
Answered by
2
Answer:
Explanation:
import java.util.Scanner;
class interest
{
public static void main(String[]args)
{
Scanner in=new Scanner(System.in);
System.out.println("Enter the sum of money to be invested");
int sum = in.nextInt();
System.out.println("The final amount for 3 years");
int amt;
amt = sum * (105/100) * (108/100) * (110/100); // we are taking the 105, 108 and 110 instead of 100 + r/100
System.out.println("Your final amount : "+amt);
}
}
Similar questions