En el curso de Java hay un error en el problema de calculadora de prestamos | Sololearn: Learn to code for FREE!

0

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

Alguien puede revisar y ver mi error

3/13/2021 4:43:54 PM

Alberto Feito

3 Answers

New Answer

+1

Me explican por qué 90/100?

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.

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); } }