0
What is wrong in this?
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double amount = scanner.nextInt(); //your code goes here for(i=0;i<3;++i) { amount = (0.9) * amount; } System.out.println(amount); } }
1 Answer
+ 7
1. Use of .nextInt() method (which reads an `int`) for value assignment of a `double` variable <amount>. Use .nextDouble().
2. Unspecified data type for variable <i> in the for...loop construct. Define data type for variable <i>.