+ 1

Loan calculater app

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 x=0; int y; while (x<6){ y=amount*10/100; amount = amount -y; System.out.println ("amount :"+amount); x++; } } } In lesson 10 (learn java) the example above for loan calculator and I wrote code but got error in excute can some one help?

31st Dec 2020, 5:15 PM
ali musadaq
ali musadaq - avatar
2 Réponses
+ 3
ali musadaq You have to initialize y with 0
31st Dec 2020, 5:50 PM
A͢J
A͢J - avatar
31st Dec 2020, 5:50 PM
Alphin K Sajan
Alphin K Sajan - avatar