Answer to Question #320238 in Java | JSP | JSF for Joy

Question #320238

Using two dimensional array, create a program that will display multiplication table but the size would be depends on the entered number of rows and columns.



Sample INPUT:



Enter numbers of ROWS: 3


Enter numbers of COLUMNS: 4



OUTPUT:



My Own Multiplication Table


***********************************************


1 2 3 4


2 4 6 8


3 6 9 12


***********************************************





1
Expert's answer
2022-03-29T07:41:34-0400
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);


        System.out.print("Enter row: ");
        int x = in.nextInt();
        System.out.print("Enter column: ");
        int y = in.nextInt();

        int[][] arr = new int[x][y];

        System.out.println("********************************************");


        for(int i = 1; i <= x; i++){
            for(int j = 1; j <= y; j++){
                System.out.print((i*j) + " ");
            }
            System.out.println("");
        }


        System.out.println("********************************************");
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS