TOPIC
Wrong Answer (100%)
William160 asked 2 months ago
Pessoal, refiz o código várias vezes e sinceramente não sei o que é :( -- No eclipse roda perfeitinho!
Scanner sc = new Scanner(System.in);
int quociente = 0;
int[] notas = { 100, 50, 20, 10, 5, 2, 1 };
int value = sc.nextInt();
if (value > 1 && value < 1000000) {
System.out.println(value);
for (int nota : notas) {
quociente = value / nota;
System.out.println(quociente + " nota(s) de R$ " + nota + ",00");
value = value % nota;
}
}
sc.close();
// Saída passando 576 como entrada
576
5 nota(s) de R$ 100,00
1 nota(s) de R$ 50,00
1 nota(s) de R$ 20,00
0 nota(s) de R$ 10,00
1 nota(s) de R$ 5,00
0 nota(s) de R$ 2,00
1 nota(s) de R$ 1,00
This topic has not been answered yet. Be the first!