Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dichharai
Last active August 2, 2020 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dichharai/0056fb14f4066ce11cecd4c788a2ed7e to your computer and use it in GitHub Desktop.
Save dichharai/0056fb14f4066ce11cecd4c788a2ed7e to your computer and use it in GitHub Desktop.
public class NestedForLoopBreak{
public static void main(String[] args){
label0:
for(int i=1; i<5; i++){
for(int j=1; j<5; j++){
for(int k=1; k<5; k++){
int l3Product = i*j*k;
if(l3Product > 10){
break label0;
}
System.out.printf("%d * %d * %d is: %d \n", i, j, k, l3Product);
}
}
}
System.out.println("Got out of 3 layer maze!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment