0

En el curso de Java hay un error en el problema de calculadora de prestamos

Alguien puede revisar y ver mi error

13th Mar 2021, 4:43 PM
Alberto Feito
Alberto Feito - avatar
3 Answers
+ 1
Me explican por qué 90/100?
7th May 2021, 7:01 PM
Nathalia RamĂ­rez
Nathalia RamĂ­rez - avatar
0
I think it is a rounding problem. Your calculation looks like this: por= amount *10/100; amount -=por; Mine looks like this: amount = (int)(amount * 0.9); I make it an int after each calculation.
13th Mar 2021, 10:04 PM
Paul
Paul - avatar
0
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 = 3; for (int i = 0; i < months; i++) amount = amount * 90 / 100; System.out.println(amount); } }
21st Apr 2021, 2:20 AM
Jose Reinaldo Parra Morales
Jose Reinaldo Parra Morales - avatar