Code:
import java.io.*;
public class array
{
public static InputStreamReader digi = new InputStreamReader (System.in);
public static BufferedReader cool = new BufferedReader (digi);
public static void main (String[] args) throws Exception {
System.out.print("Number of rows? ");
int b = Integer.parseInt(cool.readLine());
System.out.print("Number of columns? ");
int c = Integer.parseInt(cool.readLine());
int a[][]=new int [b][c];
for (int row=0;row<b;row++) {
for (int col=0;col<c;col++){
System.out.print("Element ["+row+"]["+col+"]: ");
a[row][col]=Integer.parseInt(cool.readLine());
}
}
for (int x=0;x<b;x++) {
for (int y=0;y<c;y++){
System.out.print(a[x][y]+"\t");
}
System.out.println();
}
}
}
Its only a code for outputing the user input. but Im stuck on how to put sum in every colum and row..
like this output..
Number of row? 2
Number of column? 2
3 5 = 8
4 6 = 10
= =
7 11
sumething like that?