- 1

Help me in this en java

You take a loan from a friend and need to calculate how much you will owe him after 6 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 6 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 Month 4: Payment: 10% of 14580 = 1458 Remaining amount: 13122 Month 5: Payment: 10% of 13122 = 1313 Remaining amount: 11809 Month 6: Payment: 10% of 11809 = 1181 Remaining amount: 10628

8th Mar 2021, 8:50 AM
hossin Chorfi
hossin Chorfi - avatar
4 Answers
+ 3
hossin Chorfi Just do amount = amount * 90 / 100;
8th Mar 2021, 8:56 AM
A͢J
A͢J - avatar
+ 1
Thank you
8th Mar 2021, 8:58 AM
hossin Chorfi
hossin Chorfi - avatar
+ 1
hossin Chorfi Here is my code. Maybe helps you: import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); for(int i=0;i<6;i++){ amount -= (amount * 0.1); } System.out.println(amount); } }
8th Mar 2021, 7:45 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
0
This is my answer: import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); //your code goes here int i,remain ; for(i=1;i<7;i++){ amount=amount-((amount*10)/100); } System .out.println (amount ); } }
8th Mar 2021, 8:52 AM
hossin Chorfi
hossin Chorfi - avatar