0

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%

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

6th Dec 2020, 9:37 AM
Shrish Pandey
Shrish Pandey - avatar
12 Réponses
+ 8
Is it needed to pay him back? though share your attempt first!
6th Dec 2020, 9:40 AM
Piyush
Piyush - avatar
+ 2
Since u r writing System.out.println inside while loop , Amount gets printed everytime the loop iterates... So write it after whiles closing braces' } '
6th Dec 2020, 9:54 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 2
Piyush[21 Dec❤️] True said 😂
7th Dec 2020, 6:20 PM
Sayyam Jain
Sayyam Jain - avatar
+ 1
Pls show us ur attempt first , then we will help with that..
6th Dec 2020, 9:38 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 1
int x=0; while(x<6) {int y =(amount *10)/100; amount =amount -y; System.out.println(amount); x++;}
6th Dec 2020, 9:40 AM
Shrish Pandey
Shrish Pandey - avatar
+ 1
Amount = amount *9/10 ; Why this is used
6th Dec 2020, 9:49 AM
Shrish Pandey
Shrish Pandey - avatar
0
I tried but not get the required output.
6th Dec 2020, 9:40 AM
Shrish Pandey
Shrish Pandey - avatar
0
Give some hint please
6th Dec 2020, 9:42 AM
Shrish Pandey
Shrish Pandey - avatar
0
input amount using Scanner class and Use this for loop:- for(int i=0;i<6;++i) { amount=amount*9/10; } System.out.println(amount);
6th Dec 2020, 9:44 AM
Alphin K Sajan
Alphin K Sajan - avatar
0
In my what is error
6th Dec 2020, 9:50 AM
Shrish Pandey
Shrish Pandey - avatar
0
Ohh
6th Dec 2020, 10:01 AM
Shrish Pandey
Shrish Pandey - avatar
0
Thanks brother
6th Dec 2020, 10:01 AM
Shrish Pandey
Shrish Pandey - avatar