0

Java loan can anybody help me solve?

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 months = 6; for (int x = 0; x<months; x++) amount = amount * 90 / 100; System.out.println(amount); } }

13th Oct 2021, 9:14 AM
Mischa
8 Answers
+ 3
int months = 3;
13th Oct 2021, 9:50 AM
Simba
Simba - avatar
+ 3
Oh sorry I forgot, its also giving me an invalid output here
13th Oct 2021, 9:28 AM
Nathaniel Temitope Ogunjobi
Nathaniel Temitope Ogunjobi - avatar
+ 2
Thank you both
13th Oct 2021, 9:53 AM
Mischa
+ 2
Simba Thanks sir, it worked
13th Oct 2021, 9:53 AM
Nathaniel Temitope Ogunjobi
Nathaniel Temitope Ogunjobi - avatar
+ 1
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 for(int i = 0; i < 6; i++){ double temp = amount *(10/100.0); int rem = amount - (int)Math.ceil(temp); amount = rem; } System.out.print(amount); } }
13th Oct 2021, 9:18 AM
Nathaniel Temitope Ogunjobi
Nathaniel Temitope Ogunjobi - avatar
+ 1
Its the final lesson 20 when i use this code i dont get the right outcome. But the code you use is not familiar to me. I also try you code but it gives the same outcome
13th Oct 2021, 9:21 AM
Mischa
+ 1
When i run the code in the playground enviroment i put in input 20000 it give the outcome 10628 this is when i need to complete the lesson but when i use the code on the lesson enviorment it wont accept the code
13th Oct 2021, 9:31 AM
Mischa
+ 1
I experienced same issue here sir then I left the challenge alone
13th Oct 2021, 9:32 AM
Nathaniel Temitope Ogunjobi
Nathaniel Temitope Ogunjobi - avatar