- 3
Loan calculator
How I can calculate loan code?
4 Answers
+ 15
First you can declare amount as an input variable.
Then, you need to calculate 10% of the current amount and subtract that 10% from the current amount by running a loop for 3 times.
Finally, you can get output outside loop.
By the way, I gave some hints. Try to finish it yourself. Show your try if you can't solve it anymore.
+ 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);
}
}
- 5
0
- 5
I need help on how to code a simple calculator