0

You take a loan from a friend and need to calculate how much you will owe him after 3 months. You are going to pay him back 10%

You take a loan from a friend and need to calculate how much you will owe him after 3 months. You are going to pay him back 10% of the remaining loan amount each month. Create a program that takes the loan amount as input, calculates and outputs the remaining amount after 3 months. Sample Input: 20000 Sample Output: 10628 Here is the monthly payment schedule: Month 1 Payment: 10% of 20000 = 2000 Remaining amount: 18000 Month 2 Payment: 10% of 18000 = 1800 Remaining amount: 16200 Month 3: Payment: 10% of 16200 = 1620 Remaining amount: 14580

5th Mar 2022, 2:07 AM
Ajay A
Ajay A - avatar
6 Respostas
+ 3
Try to find the solution in practice and we are here to help you solve your code errors
5th Mar 2022, 3:03 AM
Tarik Khalil
Tarik Khalil - avatar
+ 1
Many had asked questions around this (it's one of the coach's tasks). So please try to search the forum first, you may find clues (or even solutions) to this 👍
5th Mar 2022, 2:26 AM
Ipang
+ 1
public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); for (int i =0; i<3; ++i){ amount-=amount*0.1; } System.out.println(amount); } }
11th May 2022, 9:28 PM
Sardor Urokov
5th Mar 2022, 2:25 AM
HungryTradie
HungryTradie - avatar
0
What is 10%? it is 0.1 of sum. total = 20000 use for loop (range of 3) in every iteration do same calculation with total
5th Mar 2022, 6:02 AM
Shadoff
Shadoff - avatar
- 3
Can you pls slove this
5th Mar 2022, 2:08 AM
Ajay A
Ajay A - avatar