Java Tutorial For Beginner ~ Nested For Loop that generates Multiplication Table

Words
90
Reading
1 min
Listen
Play
8y


This tutorial demonstrates an example of nested for loop that generates Multiplication Table from 1 to 12.

The code to it is pasted below, you can modify it, you can use it to practicalise what we have been tutoring thus far.
If you do not understand some area feel free to drop you question or area that is not clear to you. Let's meet in our next tutorial.
Thanks.

public class ForLoopDemo {
public static void main (String []args){
System.out.println(" Multiplication Table");
System.out.println();
for (int j=1; j<=12; j++)
System.out.print(" "+ j);

       System.out.println("\n---------------------------------------------------");
       // outter for loop
       for (int i=1; i<=12;i++){
           System.out.print(i+ " | ");
           //inner for loop
           for (int j=1; j<=12; j++){
               System.out.printf("%4d", i*j);
           }
               System.out.println();
       }
    }
}

▶️ DTube
▶️ IPFS
Java Tutorial For Beginner ~ Nested For Loop that generates Multipl... | Ecency