12 Answers
New AnswerYou are not updating amount after every iteration. Use amount = b; as a last statement in loop. And 10/100 result 0 as both are int values so 0*amount is 0 here instead, use amount*10/100
You can tag the name of who you asking by type @ and select. Do you mean array in java? Better to use another thread for fresh question.. And mention some details what you don't understand with specifics.. It's a different topic and need more level discussion.. Simply an array in java is a similar collection of elements stored and retrieved under same name but different index values.. int arr[] = { 1,2,3,4,5 } ; is an array of integer values, length 5. Hope it helps...
Can you post the question and copy your code into the code playground and attach it here? Otherwise, it's very difficult to help.
Question-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
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message