program to calculate product of each column in matrix
Write a java program to calculate product of each column in matrix : import java.util.Random; import java.util.Scanner; public class ColumnWiseProduct { public static void main(String[] args) { ColumnWiseProduct cwp=new ColumnWiseProduct(); int arr[][]=cwp.readmatrix(); cwp.dispMat(arr); int prod[]=cwp.prodColWise(arr); System.out.println("Entered matrix Column wise product is :"); cwp.dispSingleArray(prod); } int[] prodColWise(int mat[][]){ int prod[]=new int[mat[0].length]; for(int i=0;i<mat[0].length;i++) { prod[i]=1; for(int j=0;j<mat.length;j++) { prod[i]=prod[i]*mat[j][i]; } } return prod; } int[][] readmatrix(){ Scanner sc=new Scanner(System.in); System.out.println("Enter Row size and column size :"); int row=sc.nextInt(); int col=sc.nextInt(); int mat[][]=new int[row][col]; System.out.println("Enter Elements in Table : "); for(int i=0;i<row;i++) { for(int