Loop Problem 3 : Multiplication table of 5

Suman Barik
0

 

// Use this editor to write, compile and run your Java code 

Question 3: Write a program to print the multiplication table of a given number n.

public class HelloWorld {

public static void main(String[] args) {

    // Practice Problem 3

        int n = 5;

        //for(int i=0; i<10; i++) - Goes from i=0 to i=9

        for(int i=1;i<=10;i++){

            System.out.printf("%d X %d = %d\n", n, i, n*i);

        }

}

}

Post a Comment

0Comments
Post a Comment (0)