import java.util.Scanner; public class Mohamed { public static void main(String[] args) { Scanner input = new Scanner(System.in); for (int i = 1; i <= 5; i++) { System.out.println("Outer loop#" + i); for (int j = 1; j <= 3; j++) { System.out.println("Nested loop#" + j); } } } } import java.util.Scanner; public class Mohamed { public static void main(String[] args) { Scanner input = new Scanner(System.in); for (int i = 1; i <= 2; i++) { System.out.println("Outer loop#i=" + i); for (int j = 1; j <= 3; j++) { System.out.println("Nested loop#j=" + j); for (int k = 1; k <= 2; k++) { System.out.println("Nested loop#k=" + k); } } } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter