0
Loan calculator project
Help me to fix and explain the problem, why my result is wrong https://code.sololearn.com/cZPyy5EABr4U/?ref=app
4 odpowiedzi
+ 1
try this😁
for(int i=0;i<6;i++){
int payment =(int)(10*amount )/100;
if((amount%10)!=0){
amount =amount-1;
}
amount = amount- payment ;
}
System .out .print(amount);
+ 1
Thank you Sebastian Utoiu
+ 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
int months = 3;
for (int i = 0; i < months; i++)
amount = amount * 90 / 100;
System.out.println(amount);
}
}
0
import java.util.Scanner ;
public class Program
{
public static void main(String[] args) {
Scanner scanner = new Scanner (System.in);
int amount = scanner.nextInt();
int aMonth;
int toMonth = 3;
for (aMonth = 1;aMonth <= toMonth;aMonth++){
amount = amount - (amount / 10);
System.out.print("month: " + aMonth );
System.out.println("remain amount: " + amount);
--amount;
}
}
}