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); } }
8 Answers
+ 3
int months = 3;
+ 3
Oh sorry I forgot, its also giving me an invalid output here
+ 2
Thank you both
+ 2
Simba
Thanks sir, it worked
+ 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);
}
}
+ 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
+ 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
+ 1
I experienced same issue here sir
then I left the challenge alone