G
Guest
Gast
HAllo kann jemand von euch helfen ?
ich habe dieses Problem und zwar kann ich compilieren aber nicht starten warum?
[/quote]
ich habe dieses Problem und zwar kann ich compilieren aber nicht starten warum?
Code:
import java.io.*;
public class Matrix
{
public static void main(String arg[]) throws IOException
{
// Declare variables and array
int N = 0;
// Create a BufferedReader object
BufferedReader in1 = new BufferedReader(new InputStreamReader(System.in));
// Prompts the user for input value N for rows & columns
System.out.println("Please enter the dimensions of the matrix.");
System.out.print("Please Enter N : ");
N = Integer.parseInt(in1.readLine());
System.out.println("The size of the matrix is : " + N + " x " + N);
// Input numbers into matrix to create the matrix
int[][] matrix = new int[N][N]; // the completed matrix
for (int i = 0; i < N; i++)
{
matrix [i] = new int[i+1];
for (int j = 0; j <= N; j++)
{
if ( (j == 0) || (j == i) )
matrix[i][j] = 1;
else
matrix[N][N] = matrix [N-1][j-1] + matrix[N-1][j];
System.out.println(matrix[N][N]);
}
System.out.println();
}
}
}[