0
Java second project loan calculator
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 y=amount; y>70/100 ; y-=10/100){ int remain= amount *90/100; System .out.println (remain); } } } Why is this wrong?
2 Respostas
+ 3
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int amount = scanner.nextInt();
int mes =1;
int res=0;
//tu código va aquí
while(mes<=3) {
res=amount*10/100;
amount-=res;
mes++;
}
System.out.println(amount);
}
}
use while y aumente el valor de mes en cada interacción para que el bucle se repita 3 veces que es la cantidad de el mes
0
Thank you ❤️😊