0
How to fix this? it says ':' expected
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 i=0; i<3 i++){ amount=(int)(amount * 90/100) } System.out.println(amount); }
4 Antworten
+ 2
You're not attentive. The compiler tells you that there is no ";" and indicates with arrows where to do it. Also you are missing "}" and it makes no sense to convert the result of the calculation, it will be of type int anyway:
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 i=0; i<3; i++){
👆
amount=amount * 90/100; 👈
}
System.out.println(amount);
}👈
}
+ 2
Thanks guys. I'm so sorry
+ 1
//add this
for(int i=0; i<3; i++)
// you forgot to use semicolo after i < 3;
+ 1
We all make mistakes at the beginning of the journey ☺️
Happy Coding! 👋😎