multiply

Java code to multiplication table using Array

Java code to multiplication table using Array

In this tutorial, we will discuss Java code to multiplication table using Array

We can display the multiplication table in the Java language in various ways. In this tutorial, we will learn how to display the multiplication table using the two-dimensional array in Java programming language

Here, we can print 10 * 10 multiplication table using two dimension array with nested for loop

Java program to multiplication table using Array with for loop

Program 1

public class MulTableInJava{
public static void main (String args[]){
int MulTable[][]=new int[10][10];
int row=1,column=1;
for(int i=0; i<MulTable.length; i++){
   for(int j=0; j<MulTable[i].length; j++){
     MulTable[i][j]=row*column;
     column=column+1;
}
row=row+1;
column=1;
}
for(int i=0; i<MulTable.length; i++){
   for(int j=0; j<MulTable[i].length; j++){
     System.out.print(" "+MulTable[i][j]+"\t| ");

}
System.out.print("\n");

}

}
}

When the above code is executed, it produces the following results

multiplication table program using Array

 

Java program to multiplication table using Array with the while loop

Here, we can print 10 * 10 multiplication table using the two-dimensional array with nested while  loop

Program 2

public class MulTable2{
public static void main (String args[]){
int MulTable[][]=new int[10][10];
int row=1,column=1;
int i=0; 
while(i<MulTable.length){
int j=0; 
   while(j<MulTable[i].length){
     MulTable[i][j]=row*column;
     column=column+1;
      j++;
}
row=row+1;
column=1;
 i++;
}
i=0;
while(i<MulTable.length){
int j=0;
   while( j<MulTable[i].length){
     System.out.print(" "+MulTable[i][j]+"\t| ");
 j++;
}
System.out.print("\n");
 i++;
}

}
}

When the above code is executed, it produces the following results

multiplication table program using Array

 

Suggested for you

Two dimension array in Java language

Operator in Java language

Data type in Java language

Nested for loop in Java language

Nested while loop in Java language

 

Java program to print multiplication table

C program to print multiplication table

C++ program to print multiplication table

Python program to print multiplication table

Java program to print multiplication table using array

C program to print multiplication table using array

C++ program to print multiplication table using array

 

 

Python program to multiply two number using function
Cpp program to Addition Subtraction,Multiplication and division
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

View Comments

Recent Posts

Explanation of one dimensional array (Data structure)

Explanation of one dimensional array In this post, we will discuss the concept of "Explanation…

2 days ago

Python program to calculate the sum of odd and even numbers in a list

Python program to calculate the sum of odd and even numbers in a list In…

5 days ago

Python code to Calculate sum of odd and even in a list

Python code to Calculate sum of odd and even in a list In this tutorial,…

1 week ago

How to find reverse number using method in Java

How to find reverse number using method In this article, we will discuss the concept…

2 weeks ago

C# inverted full pyramid star pattern

C# inverted full pyramid star pattern In this article, we will discuss the concept of…

1 month ago

C# Full Pyramid star pattern program

C# Full Pyramid star pattern program In this article, we will discuss the concept of…

2 months ago