+ 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
7 ответов
+ 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
+ 1
Can u code this using ‘for’ loop instead of ‘while’?
31st Mar 2023, 12:59 PM
SivaRanjan
+ 1
👏👏👏 Nice bro Jayakrishna 🇮🇳
31st Mar 2023, 7:53 PM
SivaRanjan
+ 1
🙏
31st Mar 2023, 8:01 PM
Jayakrishna 🇮🇳
Актуальное сегодня
Help in code