+ 2

Loan Calculator

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: 14580 https://code.sololearn.com/cs3nA4YT5vU0/?ref=app

31st Mar 2023, 7:14 AM
SivaRanjan
SivaRanjan - avatar
7 Answers
+ 3
int amount =scanner.nextInt(); for(int x=1; x<=3; x++) amount -= amount/10; //take 10.0 for precision value to include. System.out.println(amount);
31st Mar 2023, 4:38 PM
Jayakrishna šŸ‡®šŸ‡³
+ 4
What is Your question actually ?
31st Mar 2023, 7:34 AM
Jayakrishna šŸ‡®šŸ‡³
+ 2
Yes. I know this but what is your problem with the code or doubt or your question?
31st Mar 2023, 12:12 PM
Jayakrishna šŸ‡®šŸ‡³
+ 1
For example : 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
31st Mar 2023, 9:12 AM
SivaRanjan
SivaRanjan - avatar
+ 1
Can u code this using ā€˜forā€™ loop instead of ā€˜whileā€™?
31st Mar 2023, 12:59 PM
SivaRanjan
SivaRanjan - avatar
+ 1
šŸ‘šŸ‘šŸ‘ Nice bro Jayakrishna šŸ‡®šŸ‡³
31st Mar 2023, 7:53 PM
SivaRanjan
SivaRanjan - avatar
+ 1
šŸ™
31st Mar 2023, 8:01 PM
Jayakrishna šŸ‡®šŸ‡³