I ALWAYS GET THE OUTPUT AS ZERO. PLEASE TELL ME WHERE IS MY MISTAKE
import java.util.*;
class Multi
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int m1,n1,m2,n2,i,j,k;
System.out.println("Enter the no of rows for first matrix");
m1=sc.nextInt();
System.out.println("Enter the no of coloumns for first matrix");
n1=sc.nextInt();
System.out.println("Enter the no of rows for second matrix");
m2=sc.nextInt();
System.out.println("Enter the no of coloumns for second matrix");
n2=sc.nextInt();
int a[][]=new int[m1][n1];
int b[][]=new int[m2][n2];
int c[][]=new int[m1][n2];
if(n1!=m2)
System.out.println("Not possible");
else
{
System.out.println("Enter the elements of first matrix");
for(i=0;i<m1;i++)
{
for(j=0;j<n1;j++)
{
a[i][j]=sc.nextInt();
}
}
System.out.println("Enter the elements of second matrix");
for(i=0;i<m2;i++)
{
for(j=0;j<n2;j++)
{
a[i][j]=sc.nextInt();
}
}
for(i=0;i<m1;i++)
{
for(j=0;j<n2;j++)
{
c[i][j]=0;
{
for(k=0;k<n1;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
}
}
System.out.println("The multiplied matrix is");
for(i=0;i<m1;i++)
{
for(j=0;j<n2;j++)
{
System.out.print(c[i][j]+"\t");
}
System.out.println();
}
}
}
}