What have you tried? Here’s one possible solution:
class ForDemo {
public static void main(String[] args){
for(int i=1; i<11; i++){
if(i != 5){
System.out.println("Count is: " + i);
}
}
}
}
I added a check in there: if(i != 5)
which executes the code inside only if the condition is true (ie: i is not 5). This is available in most if not all programming languages.
solved For loop with exception